Error in VBA Code using Excel 2021

microhunt

Board Regular
Joined
Aug 14, 2017
Messages
63
Office Version
  1. 2021
Platform
  1. Windows
I keep getting an error when I run this in Excel. Can anyone see the problem?

Option VBASupport 1
Sub ClearChecks_Q()
Dim CB As CheckBox
For Each CB In ActiveSheet.CheckBoxes
If Not Intersect(CB.TopLeftCell, Range("V6:X1077")) Is Nothing Then
CB.Value = xlOff
End If
Next CB
End Sub
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
There is no such thing as Option VBASupport 1 in VBA. Are you trying to run this in Libre, or Open Office as per your other threads?
 
Upvote 0
Solution
Glad you spotted this I copied macro back to excel from the open office and obviously corrupted my excel sheet Unfortunately I have no backup of this sheet.

Kind Regards

Microhunt
 
Upvote 0
Will this work then do you think?

Sub ClearChecks_Q()
Dim CB As CheckBox
For Each CB In ActiveSheet.CheckBoxes
If Not Intersect(CB.TopLeftCell, Range("V6:X1077")) Is Nothing Then
CB.Value = xlOff
End If
Next CB
End Sub
 
Upvote 0
Best way to find out, is to try it. ;)
 
Upvote 0
Glad it's sorted & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top