ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Check Box (https://www.excelbanter.com/excel-discussion-misc-queries/75693-check-box.html)

Jeff

Check Box
 
Hi,

I have a form with a checkbox and then two textboxes that are associated
with the checkbox. So I want to make the checkboxes unshaded when the
checkbox is selected and "shaded" when the checkbox is not checked. I have
seen this before in forms. I tried using the "visible" property but this
makes the entire box disappear, and I only want it "shadded"

Has anyone done something like this before - do you know what property to use.

Thanks

Toppers

Check Box
 
Jeff,
Would this suffice? If so, you probably want to put the ELSE code
in the Userform_Initialize routine.

Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
TextBox1.Enabled = True
TextBox2.Enabled = True
TextBox1.BackColor = &H8000000F
TextBox2.BackColor = &H8000000F
Else
TextBox1.Enabled = False
TextBox2.Enabled = False
TextBox1.BackColor = &H80000011
TextBox2.BackColor = &H80000011
End If

End Sub

"Jeff" wrote:

Hi,

I have a form with a checkbox and then two textboxes that are associated
with the checkbox. So I want to make the checkboxes unshaded when the
checkbox is selected and "shaded" when the checkbox is not checked. I have
seen this before in forms. I tried using the "visible" property but this
makes the entire box disappear, and I only want it "shadded"

Has anyone done something like this before - do you know what property to use.

Thanks



All times are GMT +1. The time now is 11:15 PM.

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