Dynamic textbox backcolor change in a userform


Posted by Rory on October 16, 2001 10:52 AM

Hi,
I have textboxes on a userform that get data from cells. I would like to change the background color of a textbox if it contains a value.
I have tried: if userform1.textbox1.value <>"" then backcolor = &H00C0FFFF& but this pulls up the chart tool menu for some reason and changes the form color, not the textbox.
Anyone have any ideas.
Thanx Rory

Posted by Juan Pablo on October 16, 2001 11:10 AM

Use

If TextBox1 <> "" then TextBox1.BackColor = &H00C0FFFF&


Juan Pablo

Posted by Rory on October 16, 2001 1:33 PM

Many thanx Juan

For anyone following this thread, juan's code needs to go in UserForm_Initialize()



Posted by Juan Pablo on October 16, 2001 1:42 PM

Or you could put it in TextBox1_Change(), TextBox1_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean).

Juan Pablo