Blinking Text on Userform

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
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,364
Office Version
365
Platform
Windows
If all you want to do is highlight the good/bad data couldn't you change the back colour of the textbox(s) instead of the font?

All you would need to do is change ForeColor to BackColor.
 

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
18,204
Office Version
2013
Platform
Windows
Hi Brian
I'd consider something like Nories idea rather than flashing text.
Flashing text is one of the most frustrating and annoying things you can do to a worksheet / textbox / userform.
You'll soon get plenty of feedback by implementing flashing text, as well as slowing everything down in your worksheet as well.
I've generally found them to be a fairly hungry "toy" to have running !

If you need to do this, have a look at something like this
Code:
http://www.mrexcel.com/forum/showthread.php?t=428425
 

brianburen

New Member
Joined
Aug 24, 2010
Messages
44
I tried the code in the link u posted but it didnt work for me.

Where exactly do I put the code? We open the userform to check equipment calibration dates. I have a label that show GOOD in green letters or BAD in red letters. I wanted either the box or the text to flash.

thanks for your help so far
 

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
18,204
Office Version
2013
Platform
Windows
Sorry Brian....that thread was incomplete.
try this one.
Domenic also explains where to place the code and what it does.
Code:
http://www.mrexcel.com/forum/showthread.php?t=553536
 

Forum statistics

Threads
1,082,548
Messages
5,366,227
Members
400,880
Latest member
dwb

Some videos you may like

This Week's Hot Topics

Top