brianburen
New Member
- Joined
- Aug 24, 2010
- Messages
- 44
I have a user form that has a text box that displays either OK or BAD based on a cell value on a sheet named "FORM-DATA.
I have put code in to change the color of the font based on the value, but I woudl like to make the text flash if it says "BAD".
I have searched all the threads i can think of and they all talke about flashing text in cells on sheets.
Have I missed a thread?
This is what I have so far:
Private Sub UserForm_Activate()
Dim ws As Worksheet
Set ws = Worksheets("FORM-DATA")
Application.ScreenUpdating = True
Me.UnitSTAT.value = ws.Range("e2")
If UnitSTAT.value = "BAD" Then
UnitSTAT.ForeColor = vbRed
End If
If UnitSTAT.value = "OK" Then
UnitSTAT.ForeColor = vbGreen
End If
Me.puSTAT.value = ws.Range("e3")
If puSTAT.value = "BAD" Then
puSTAT.ForeColor = vbRed
End If
If puSTAT.value = "OK" Then
puSTAT.ForeColor = vbGreen
End If
Me.tmSTAT.value = ws.Range("e4")
If tmSTAT.value = "BAD" Then
tmSTAT.ForeColor = vbRed
End If
If tmSTAT.value = "OK" Then
tmSTAT.ForeColor = vbGreen
End If
Me.pitSTAT.value = ws.Range("e5")
If pitSTAT.value = "BAD" Then
pitSTAT.ForeColor = vbRed
End If
If pitSTAT.value = "OK" Then
pitSTAT.ForeColor = vbGreen
End If
Me.slotSTAT.value = ws.Range("e6")
If slotSTAT.value = "BAD" Then
slotSTAT.ForeColor = vbRed
End If
If slotSTAT.value = "OK" Then
slotSTAT.ForeColor = vbGreen
End If
Me.yokeSTAT.value = ws.Range("e7")
If yokeSTAT.value = "BAD" Then
yokeSTAT.ForeColor = vbRed
End If
If yokeSTAT.value = "OK" Then
yokeSTAT.ForeColor = vbGreen
End If
End Sub
I have put code in to change the color of the font based on the value, but I woudl like to make the text flash if it says "BAD".
I have searched all the threads i can think of and they all talke about flashing text in cells on sheets.
Have I missed a thread?
This is what I have so far:
Private Sub UserForm_Activate()
Dim ws As Worksheet
Set ws = Worksheets("FORM-DATA")
Application.ScreenUpdating = True
Me.UnitSTAT.value = ws.Range("e2")
If UnitSTAT.value = "BAD" Then
UnitSTAT.ForeColor = vbRed
End If
If UnitSTAT.value = "OK" Then
UnitSTAT.ForeColor = vbGreen
End If
Me.puSTAT.value = ws.Range("e3")
If puSTAT.value = "BAD" Then
puSTAT.ForeColor = vbRed
End If
If puSTAT.value = "OK" Then
puSTAT.ForeColor = vbGreen
End If
Me.tmSTAT.value = ws.Range("e4")
If tmSTAT.value = "BAD" Then
tmSTAT.ForeColor = vbRed
End If
If tmSTAT.value = "OK" Then
tmSTAT.ForeColor = vbGreen
End If
Me.pitSTAT.value = ws.Range("e5")
If pitSTAT.value = "BAD" Then
pitSTAT.ForeColor = vbRed
End If
If pitSTAT.value = "OK" Then
pitSTAT.ForeColor = vbGreen
End If
Me.slotSTAT.value = ws.Range("e6")
If slotSTAT.value = "BAD" Then
slotSTAT.ForeColor = vbRed
End If
If slotSTAT.value = "OK" Then
slotSTAT.ForeColor = vbGreen
End If
Me.yokeSTAT.value = ws.Range("e7")
If yokeSTAT.value = "BAD" Then
yokeSTAT.ForeColor = vbRed
End If
If yokeSTAT.value = "OK" Then
yokeSTAT.ForeColor = vbGreen
End If
End Sub