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
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
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.
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,584
Messages
6,120,385
Members
448,956
Latest member
JPav

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top