ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   conditional format a label (https://www.excelbanter.com/excel-discussion-misc-queries/83043-conditional-format-label.html)

damorrison

conditional format a label
 
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??


Bob Phillips

conditional format a label
 
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)

"damorrison" wrote in message
oups.com...
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??




Toppers

conditional format a label
 
Try:

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


"damorrison" wrote:

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??



damorrison

conditional format a label
 
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



All times are GMT +1. The time now is 07:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com