This is driving me mad.
I have a series of Macro's which, thanks to some help from this forum, were working perfectly.
An example:
Sub Workbook_OB()
'Forms ToolBox
Dim i As Long
Dim cnt As Long
cnt = 0
With Sheet1
For i = 130 To 134
If .CheckBoxes("Check box " & i).Value = 1 Then
cnt = 1
Exit For
End If
Next
End With
If cnt = 0 Then
MsgBox "Please choose an option for the Sentencing Occasion"
Exit Sub
End If
cnt = 0
With Sheet1
For i = 137 To 141
If .CheckBoxes("Check box " & i).Value = 1 Then
cnt = 1
Exit For
End If
Next
End With
If cnt = 0 Then
MsgBox "Please choose an option for the Custodial Occasion"
Exit Sub
End If
End Sub
The Macro checks that at least one check-box in a range has been ticked, and returns an error if that is not the case.
However. If I attempt to replicate this Macro but for a different range of check-boxes, by copying the code into a new module and changing the numbers, I.e
To
I suddenly am getting an error message(s):
Unable to get the value property of the checkbox class.
OR
method checkboxes of object _worksheet failed
What has changed!?
I have a feeling there is something going on around where my macro's are saved and stored. But it doesn't work even if the module is hosted in my Personal.xls file.
I would really appreciate it if somebody could shed light on this for me. This place is becoming like my second home...
Bookmarks