Archive of Mr Excel Message Board


Back to Controls in Excel archive index
Back to archive home

Check Box

Posted by Joe C on October 22, 2001 11:50 AM
I put a checkbox in a spread sheet.
How do I reference it in VBA to see if it is true or false.
Can I put a checkbox in a sheet, and use it in this manner?
I tried
If CheckBox15 = True Then
but it does not seem to be checking the value.

Re: Check Box

Posted by Jonathan on October 22, 2001 4:43 PM
Hmmm. Works for me if I reference it like this:

If Sheet1.CheckBox1.Value = True Then
MsgBox "True"
Else
MsgBox "False"
End If

Actually you can leave the .value part off

If Sheet1.CheckBox1 = True Then
MsgBox "True"
Else
MsgBox "False"
End If

because Value is the default property of the checkbox.

HTH


Sh#t forgot the Sheet

Posted by Joe C on October 23, 2001 8:03 AM
Sheet1. I was missing that.
Thanks

This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.