I have created a checkbox on my Excel Work sheet, using design mode I have leftclicked it and named it ChkV, and I wrote a VBA code but when I run it I get an message telling that the variable is not defined.
If ChkV.Value = True Then
' my code
End If
Did I not label the check box correctly, what am I doing wrong ? How should I fix the mistake?
Should it not be
?
You have this error when you call your code outside
Sheet module
where yourcheckbox
is located. To improve your code you need to add references to sheet wherecheckbox
belongs to, like:Hi i was breaking my head over and over again for this, but searching i found that you need to refer by the
CodeName
's sheet or usingOleObjects
By
Code Name
is how you see in the VBA Project tree:By
OleObjects
is:Note that my Excel is in Spanish thats why you see
Hoja1
, in English isSheet1
and you can find something else here.