ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Setting a CheckBox Value to False (https://www.excelbanter.com/excel-programming/337303-setting-checkbox-value-false.html)

The Hawk

Setting a CheckBox Value to False
 
Hi: I'd like to set a checkbox value to false after selection of an item
from a Combo Box. I've tried various things, but cannot seem to get the
correct syntax. Both the Combo Box and Check Box are on a User Form. The
latest code tried is:

Private Sub cmbMembers_Change()
If Val(cmbMembers.Value) 0 Then
Cells(cmbMembers.Value, 1).Select
CheckBox1.Enabled = True: Value = False
Else
CheckBox1.Enabled = False
CheckBox2.Enabled = False
CheckBox3.Enabled = False
End If
End Sub

Any help will be appreciated...

Ron de Bruin

Setting a CheckBox Value to False
 
Hi

You must use the value property of the checkbox

CheckBox1.Value = False

--
Regards Ron de Bruin
http://www.rondebruin.nl


"The Hawk" wrote in message ...
Hi: I'd like to set a checkbox value to false after selection of an item
from a Combo Box. I've tried various things, but cannot seem to get the
correct syntax. Both the Combo Box and Check Box are on a User Form. The
latest code tried is:

Private Sub cmbMembers_Change()
If Val(cmbMembers.Value) 0 Then
Cells(cmbMembers.Value, 1).Select
CheckBox1.Enabled = True: Value = False
Else
CheckBox1.Enabled = False
CheckBox2.Enabled = False
CheckBox3.Enabled = False
End If
End Sub

Any help will be appreciated...




The Hawk

Setting a CheckBox Value to False
 
Folks: I figured it out. Here's the final code:
Private Sub cmbMembers_Change()
If Val(cmbMembers.Value) 0 Then
Cells(cmbMembers.Value, 1).Select
CheckBox1.Enabled = True
CheckBox1.Value = Cells(cmbMembers.Value, 4)
Else
CheckBox1.Enabled = False
CheckBox2.Enabled = False
CheckBox3.Enabled = False
End If
End Sub

Thanks...

"The Hawk" wrote:

Hi: I'd like to set a checkbox value to false after selection of an item
from a Combo Box. I've tried various things, but cannot seem to get the
correct syntax. Both the Combo Box and Check Box are on a User Form. The
latest code tried is:

Private Sub cmbMembers_Change()
If Val(cmbMembers.Value) 0 Then
Cells(cmbMembers.Value, 1).Select
CheckBox1.Enabled = True: Value = False
Else
CheckBox1.Enabled = False
CheckBox2.Enabled = False
CheckBox3.Enabled = False
End If
End Sub

Any help will be appreciated...


Tom Ogilvy

Setting a CheckBox Value to False
 
Private Sub cmbMembers_Change()
If Val(cmbMembers.Value) 0 Then
Cells(cmbMembers.Value, 1).Select
CheckBox1.Enabled = True
CheckBox1.Value = False
Else
CheckBox1.Enabled = False
CheckBox2.Enabled = False
CheckBox3.Enabled = False
End If
End Sub



"The Hawk" wrote in message
...
Hi: I'd like to set a checkbox value to false after selection of an item
from a Combo Box. I've tried various things, but cannot seem to get the
correct syntax. Both the Combo Box and Check Box are on a User Form. The
latest code tried is:

Private Sub cmbMembers_Change()
If Val(cmbMembers.Value) 0 Then
Cells(cmbMembers.Value, 1).Select
CheckBox1.Enabled = True: Value = False
Else
CheckBox1.Enabled = False
CheckBox2.Enabled = False
CheckBox3.Enabled = False
End If
End Sub

Any help will be appreciated...




Raman325[_17_]

Setting a CheckBox Value to False
 

or

With CheckBox1
..Enabled = True
..Value = False
End With


--
Raman325
------------------------------------------------------------------------
Raman325's Profile: http://www.excelforum.com/member.php...o&userid=24748
View this thread: http://www.excelforum.com/showthread...hreadid=395909


theguz[_6_]

Setting a CheckBox Value to False
 

Or:

'I am assuming the name of the form is UserForm1

UserForm1.Controls("CheckBox1").Value = False

Hope this helps

theguz


--
theguz
------------------------------------------------------------------------
theguz's Profile: http://www.excelforum.com/member.php...o&userid=24918
View this thread: http://www.excelforum.com/showthread...hreadid=395909



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

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