Disabling Text Boxes in UserForm

Master_G

New Member
Joined
May 3, 2011
Messages
6
Hopefully a quick question for you guys:

I have a userform with 3 tick boxes, I want the choice of which box is ticked to disable inappropriate text boxes for the user. Ticking one box also disables the other tick boxes.

To do this I currently have the code:
Code:
If Tick1 = True Then:
 
Tick2.Enabled = False
Tick3.Enabled = False
Box2.Enabled = False
Box3.Enabled = False
 
Else
 
Tick2.Enabled = True
Tick3.Enabled = True
Box2.Enabled = True
Box3.Enabled = True
 
End If

When I check one of the tick boxes the other tick boxes are disabled but the text boxes remain :confused:

Any help appreciated!

G
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Using:
Code:
TextBox1.Enabled = False
should not allow the user to select the textbox to enter data. Does it absolutely need to be greyed out?
 
Last edited:
Upvote 0
You can grey it out using:
Code:
TextBox1.Enabled = False
TextBox1.ForeColor = SystemColorConstants.vbGrayText
I don't see the difference in the textbox when its greyed out, unless there was text already in it.
 
Last edited:
Upvote 0
Ah, I thought they would automatically be greyed out like the tick boxes are (shoddy testing on my part means I didn't even test whether you could select them or not!)
It doesn't absolutely have to be greyed out, although would be nice to do so to guide the user.
What I will do instead is use Box1.Visible = False to hide them if they aren't to be used.
Thanks for reply, apologies for being so dim as to not actually try using the boxes!

G
 
Upvote 0

Forum statistics

Threads
1,224,557
Messages
6,179,508
Members
452,918
Latest member
Davion615

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top