Reading a checkbox value in Excel 2010 using VBA generates error 424
Posted on 2013-05-13
I have a very simple Excel VBA program to read the value of a Forms checkbox, which I created from the Developer > Insert menu. Excel assigned the name CheckBox1 to my checkbox and created the "Sub" and "End Sub" statements for me.
I then inserted 3 lines to read the value of the checkbox and display a MsgBox if the checkbox is checked. The complete program is:
If CheckBox1.Value = True Then
MsgBox ("Box checked")
VBA generates "Run-time error '424': Object required" on the 2nd line (the If statement). This error was generated on my work computer so I came home and got the same error on my home computer. I Googled for several hours and also looked here, but found nothing relevant other than lots of example programs which do the same thing I did above.
When I created the above program, I opened up a new spreadsheet and am on Sheet1 of Book1. Checkbox1 is the only control I've generated. Again, it's Forms, not ActiveX.
Thanks for your help with this.