ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Quick and Easy from Checkboxes (https://www.excelbanter.com/excel-programming/345075-quick-easy-checkboxes.html)

RPIJG[_82_]

Quick and Easy from Checkboxes
 

So I'm having an issue with Checkbox values...

I just want my code to do this...

If Checkbox1 is checked then run this code End if

If Checkbox1 is unchecked then run this code End if

Somehow or another it just doesn't seem to be working for me, I tried

If Checkbox1.Checked=True Then
'Code
End If
If Checkbox1.Checked=False Then
'Code
End If

For some reason, it didn't agree with me, it gave me a Compile Error
and said Method or Data Member not found. I give up. Checkbox is in a
userform by the way, not sure if that makes a difference or not.


--
RPIJG
------------------------------------------------------------------------
RPIJG's Profile: http://www.excelforum.com/member.php...fo&userid=9285
View this thread: http://www.excelforum.com/showthread...hreadid=483304


Rowan Drummond[_3_]

Quick and Easy from Checkboxes
 
Try:

If CheckBox1.Value = True Then
MsgBox "checked"
Else
MsgBox "not Checked"
End If

Hope this helps
Rowan

RPIJG wrote:
So I'm having an issue with Checkbox values...

I just want my code to do this...

If Checkbox1 is checked then run this code End if

If Checkbox1 is unchecked then run this code End if

Somehow or another it just doesn't seem to be working for me, I tried

If Checkbox1.Checked=True Then
'Code
End If
If Checkbox1.Checked=False Then
'Code
End If

For some reason, it didn't agree with me, it gave me a Compile Error
and said Method or Data Member not found. I give up. Checkbox is in a
userform by the way, not sure if that makes a difference or not.



RPIJG[_85_]

Quick and Easy from Checkboxes
 

Thanks that worked like a charm, for some reason the VB help inde
showed it as Checked instead of Value, replacing fixed the proble
right up

--
RPIJ
-----------------------------------------------------------------------
RPIJG's Profile: http://www.excelforum.com/member.php...nfo&userid=928
View this thread: http://www.excelforum.com/showthread.php?threadid=48330


Rowan Drummond[_3_]

Quick and Easy from Checkboxes
 
You're welcome.

PS you may have been looking at help for the checkboxes collection
rather than the Checkbox Control.

RPIJG wrote:
Thanks that worked like a charm, for some reason the VB help index
showed it as Checked instead of Value, replacing fixed the problem
right up.




All times are GMT +1. The time now is 05:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com