2 more userform questions

mortgageman

Well-known Member
Joined
Jun 30, 2005
Messages
2,015
1) can option boxes be "greyed out" (based on a condition of course)

and

2) Can text boxes be set to a different color?

Gene, "The Mortgage Man", Klein
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Hello Gene,

Yes you can do both of these:

1) To "grey out" CheckBoxes or OptionButtons, set the
"Enabled" property to False.

2) For TextBox color, set the "BackColor" property to the
appropriate color.

Ciao,

Don.
 
Upvote 0
2) For TextBox color, set the "BackColor" property to the
appropriate color.

Are these back color properties numbers, or are they "vb"constants (like vbCrLf is the constant for Enter in VBA)

Gene, "The Mortgage Man", Klein
 
Upvote 0
You can set the color in the properties window of the text box next to back color, or you can set up change events in other objects to toggle the enabled.true/false proprety of your buttons.

For example, if TextBox2 has text entered you could enter this in TextBox2 after uptate
Code:
TextBox2_AfterUpdate()

TextBox1.Enabled = True

End Sub
If a certain condition needs to be met to enable the button
Code:
TextBox2_AfterUpdate()

If TextBox2.Text = "monkeynuts"  ' change monkeynuts to your desired text"
TextBox1.Enabled = True
End IF

End Sub

You can likewise change otherpropeties such as .visible etc the same way on certain events for other objects on your form.

Obviously change textbox1 to optionbox1 etc as needed to suit.
 
Upvote 0
Gene

I just tried these and they worked.
Code:
TextBox1.BackColor = vbGreen
Code:
TextBox1.BackColor = vbRed
 
Upvote 0
Norie - thanks - thats exactly what I needed (I should have tried it myself ofcourse, :oops: but oh well)

Gibbs - I'm not sure what question of mine you were answering, :unsure: but thanks - you gave me a lot of stuff to work with. :cool:

Gene, "The Mortgage Man", Klein
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,256
Members
448,557
Latest member
richa mishra

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