Blinking Text

PRINCESS

Board Regular
Joined
Oct 28, 2002
Messages
73
Hello my geniuses,

Last night I went through several post with VBA code on how to make text blink. Some of the VBA's and instructions were a bit complex, but I found one that was pretty simple. The only problem is that once I change my
cell to show blank and than change it back to the blinking text parameter, it no longer run the VBA. I guess what I need is something that will restart the VBA everytime the cell changes, instead of just once. Oh ya one more thing, I want my text to be red/white, instead of black/white. Thanx guys!

This is what is in my cell:
=IF(AND($D$6<>"",$H$6<>""),IF($E$19="","UNABLE TO FIND CARRIER OR ROUTING - CHECK WITH SUPERVISOR",""),"")

And this is the VBA:

Option Explicit

Sub ChangeColor()

If Range("C8").Interior.ColorIndex = xlNone Then
Range("C8").Interior.ColorIndex = 1
Range("C8").Font.ColorIndex = 2
Else
Range("C8").Interior.ColorIndex = xlNone
Range("C8").Font.ColorIndex = 1
End If

If Range("C8").Text = "UNABLE TO FIND CARRIER OR ROUTING - CHECK WITH SUPERVISOR" Then
Application.OnTime Now + TimeSerial(0, 0, 1), "ChangeColor"
Else
Range("C8").Interior.ColorIndex = xlNone
Range("C8").Font.ColorIndex = 1
End If

End Sub
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
For Red/White edit ChangeColor() to:

<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> ChangeColor()

    <SPAN style="color:#00007F">If</SPAN> Range("C8").Interior.ColorIndex = xlNone <SPAN style="color:#00007F">Then</SPAN>
        Range("C8").Interior.ColorIndex = 3
        Range("C8").Font.ColorIndex = 2
    <SPAN style="color:#00007F">Else</SPAN>
        Range("C8").Interior.ColorIndex = xlNone
        Range("C8").Font.ColorIndex = 3
    <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN>
    
    <SPAN style="color:#00007F">If</SPAN> Range("C8").Text = "UNABLE TO FIND CARRIER OR ROUTING - CHECK WITH SUPERVISOR" <SPAN style="color:#00007F">Then</SPAN>
        Application.OnTime Now + TimeSerial(0, 0, 1), "ChangeColor"
    <SPAN style="color:#00007F">Else</SPAN>
        Range("C8").Interior.ColorIndex = xlNone
        Range("C8").Font.ColorIndex = 1
    <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN>

<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
</FONT><hr>For the other, add code to the worksheet:

<font face=Courier New><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> Worksheet_Change(<SPAN style="color:#00007F">ByVal</SPAN> Target <SPAN style="color:#00007F">As</SPAN> Range)
    <SPAN style="color:#00007F">If</SPAN> Target.Address = "$C$8" <SPAN style="color:#00007F">Then</SPAN> ChangeColor
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
</FONT><hr>To add code to a worksheet:
  1. Right-click the tab for the sheet to which you want to add the code.
  2. Click on View Code... from the popup menu.
  3. Copy and Paste code or
    <ul type=disc>
  4. Pick Worksheet from the left combobox at the top of the code pane
  5. If SelectionChange (the default) is not the correct event, then click the appropriate event from the combobox at the right.
[/list]HTH
 
Upvote 0
Thanx Greg. I am still getting the same issue, when I change it and go back it doesn't blink anymore. I than have to go to Macro/Run and run the
VB, shouldn't this autorun? I put the ChangeColor VB in module1 and the new code on the worksheet, am I doing anything wrong?

Martha
 
Upvote 0
Just me with a DOH moment... C8 has a formula, doesn't it? Assuming that's the case, then something like this in the worksheet's code module would serve you better:

<font face=Courier New><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> Worksheet_Change(<SPAN style="color:#00007F">ByVal</SPAN> Target <SPAN style="color:#00007F">As</SPAN> Range)
    <SPAN style="color:#00007F">Dim</SPAN> rngPrec <SPAN style="color:#00007F">As</SPAN> Range
    <SPAN style="color:#00007F">Set</SPAN> rngPrec = Range("C8").Precedents
    <SPAN style="color:#00007F">If</SPAN> <SPAN style="color:#00007F">Not</SPAN> Intersect(Target, rngPrec) <SPAN style="color:#00007F">Is</SPAN> <SPAN style="color:#00007F">Nothing</SPAN> <SPAN style="color:#00007F">Then</SPAN> ChangeColor
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
</FONT>
 
Upvote 0
What is the whole code?

I've been wanting to do this for years and didn't know it was possible. I'm looking to do a f(x) in C3 that says if if(c1<>C2,"Out of Balance","OK") and have the result blink.

I'm also getting the message, "The macro "C:\My Documents/Text Flash.xls'!ChangeColor' cannot be found."

Thanks
 
Upvote 0
You need to add ChangeColor() to a standard module (see below if you've not done that before). In your case you'd want to edit it, changing the references to "C8" to refer to "C3".
So the line that tests whether to flash or not would read something like:

Code:
If Range("C3").Text = "Out of Balance" Then
------------------------------------

Then add the code to a worksheet module (see my post of 11:01), again changing the "C8" to "C3".

As Princess indicates, all the code you need is here on this thread.<hr>

To add code to a workbook:
  1. Alt+F11 to get to the Visual Basic Editor (VBE).
  2. From the VBE menu Insert|Module
  3. Add in code (copy and paste).
  4. Alt+F11 again to jump back to Excel.
  5. Alt+F8 then pick the macro from the list.
Note: It's usually a good idea to save your work before running new macros.<hr>If you wish to always have the macro available and not just when one particular workbook is open - i.e. the macro is a "generic" macro; it is better to place the macro in your Personal Macro Workbook. This is a workbook that Excel automatically creates. If you use the Macro Recorder to record a macro, the dialog box asks where you want to store the macro: (a) the active wb, (b) a new wb or (c) in your Personal Macro wb. If you select Personal Macro Workbook and you have not previously recorded a macro there, Excel will create it for you, naming it Personal.xls and placing it in your Excel startup directory. This way every time you start Excel, Personal.xls will load and its macros will be available to you. (Note that Personal.xls is a hidden workbook and not an Excel Add-In.)

Note particular to this post: in this particular case you'd not need to pick the macro from the list since the _Change event handler in the worksheet's code module would initiate the process for you.
 
Upvote 0

Forum statistics

Threads
1,214,376
Messages
6,119,174
Members
448,870
Latest member
max_pedreira

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