conditional format a label

  • Thread starter Thread starter damorrison
  • Start date Start date
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??
 
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)
 
Try:

If Val(Label1.Caption) < 8.25 Then
Label1.BackColor = &HFF& '<===Red
Else
Label1.BackColor = &H8000000F '<== standard
End If
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top