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

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
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, :huh: but thanks - you gave me a lot of stuff to work with. 8-)

Gene, "The Mortgage Man", Klein
 
Upvote 0

Forum statistics

Threads
1,224,247
Messages
6,177,404
Members
452,774
Latest member
Macca1962

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