S
Shazi
Hi Everyone,
I put a textbox1 in userform1, the textbox1 is link to sheet1, with
B5.
My userform get the value from B5, when it loads. I want to make a
function like this that, if the value is < 50 then it would be Red,
otherwise it will be White.
I arrange like this, but its not working.
I request to guide me accordingly.
Private Sub TextBox1_AfterUpdate()
If Val(TextBox1.Text) < 50 Then
TextBox1.BackColor = vbRed
Else
TextBox1.BackColor = vbWhite
End If
End Sub
Private Sub UserForm_Initialize()
TextBox1.Value = Sheets("Sheet1").Range("B5")
End Sub
Thanks and regards.
Shahzad
I put a textbox1 in userform1, the textbox1 is link to sheet1, with
B5.
My userform get the value from B5, when it loads. I want to make a
function like this that, if the value is < 50 then it would be Red,
otherwise it will be White.
I arrange like this, but its not working.
I request to guide me accordingly.
Private Sub TextBox1_AfterUpdate()
If Val(TextBox1.Text) < 50 Then
TextBox1.BackColor = vbRed
Else
TextBox1.BackColor = vbWhite
End If
End Sub
Private Sub UserForm_Initialize()
TextBox1.Value = Sheets("Sheet1").Range("B5")
End Sub
Thanks and regards.
Shahzad