conditional format a label

D

damorrison

I have a UserForm that that has several textboxes and labels, when the
text box changes it calculates and the value is put into a label
caption

is there a way to get a label to turn red if the value is less than
8.25??
 
B

Bob Phillips

Only by checking the value in the textbox on completion, such as the Exit
event, and then setting the label colour.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
T

Toppers

Try:

If Val(Label1.Caption) < 8.25 Then
Label1.BackColor = &HFF& '<===Red
Else
Label1.BackColor = &H8000000F '<== standard
End If
 
D

damorrison

Unbelievable, it really works, at first I put the code in the label1
click and it only worked when I clicked on the label
Then I put it in the textbox change, and voila, works every time
Thanks, very cool
 
Top