View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
John Wilson John Wilson is offline
external usenet poster
 
Posts: 550
Default Text box format VBA

gregork,

In the TextBox AfterUpdate Event.

Private Sub TextBox1_AfterUpdate()
If Val(TextBox1.Value) Worksheets("Sheet1").Range("C1").Value And _
Val(TextBox1.Value) < Worksheets("Sheet1").Range("C2").Value Then
TextBox1.BackColor = vbRed
Else
TextBox1.BackColor = vbWhite
End If
End Sub

John

"gregork" wrote in message
...
Hi All,
Can you conditionally format a text box back colour on a user form? For
instance if the value in textbox1 was not in between (sheet1 cell= C1 and
sheet1 cell= C2) make the textbox1 back colour red.
How would you do this?

Regards
gregork