a hard one

Chavira55

Board Regular
Joined
Sep 19, 2002
Messages
65
can someone help with this?
cell bw43 is a percentage result of a formula(formula is in bw43) how can I make VBA to flash in the result in red or the cell flash in red when it is a positive number?? I've looked at other post, but can not get one to work with what I need.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
does it have to flash? Or can the positive results just be red, if so look at conditional formatting...
 
Upvote 0
I will investigate, but I don't think Excel currently has a flash attribute for fonts/colors.

My guess is that the up-and-coming 'XML' formatting will accomodate blinking, just as html does, now.

Until then, I have my doubts that it will be easy to flash text in a worksheet.

Still looking, however.
This message was edited by stevebausch on 2002-10-09 20:31
 
Upvote 0
Hi Chavira55,

It does not makes cells red, but makes user pay attention.
Put this code into worksheet module.


<PRE><FONT color=red>Option Explicit</FONT>



<FONT color=red>Private <FONT color=red>Sub </FONT></FONT>Worksheet_Calculate()

<FONT color=red>If </FONT>[BW43].Value >= 0<FONT color=red> Then </FONT><FONT color=red>Call</FONT> Blink([BW43])

<FONT color=red>End Sub</FONT>



<FONT color=red>Private <FONT color=red>Sub </FONT></FONT>Blink(<FONT color=red>ByVal</FONT> rng <FONT color=red>As</FONT> Range)

<FONT color=#666699> 'Thanks for My friend Mr.Hiko
</FONT>
<FONT color=red>Const </FONT>sngInterval <FONT color=red>As</FONT><FONT color=red> Single</FONT> = 0.1 <FONT color=#666699>'Flash Interval
</FONT>
<FONT color=red>Const </FONT>lngTimes <FONT color=red>As</FONT><FONT color=red> Long</FONT> = 3 <FONT color=#666699>'Flash Times
</FONT>
<FONT color=red>Dim </FONT>rngSelected <FONT color=red>As</FONT> Range

<FONT color=red>Dim </FONT>rngPlus <FONT color=red>As</FONT> Range

<FONT color=red>Dim </FONT>lngCnt <FONT color=red>As</FONT><FONT color=red> Long</FONT>

<FONT color=red>Set </FONT>rngSelected = Selection

<FONT color=red>Set </FONT>rngPlus = Union(rng.EntireColumn, rng.EntireRow)

<FONT color=red>For </FONT>lngCnt = 1 <FONT color=red>To </FONT>lngTimes

rngPlus.Select

rng.Activate

myWait sngInterval

rng.Select

myWait sngInterval

Next

rngSelected.Select

<FONT color=red>Set </FONT>rngSelected =<FONT color=red> Nothing</FONT>

<FONT color=red>End Sub</FONT>



<FONT color=red>Private <FONT color=red>Sub </FONT></FONT>myWait(sngInterval <FONT color=red>As</FONT><FONT color=red> Single</FONT>)

<FONT color=red>Dim </FONT>sngTime <FONT color=red>As</FONT><FONT color=red> Single</FONT>

<FONT color=red>Dim </FONT>sngPrev <FONT color=red>As</FONT><FONT color=red> Single</FONT>

sngTime = Timer + sngInterval

Do

sngPrev = Timer

DoEvents

<FONT color=red>Loop</FONT> While sngTime > Timer Or sngPrev >= Timer

<FONT color=red>End Sub</FONT>




</PRE>
 
Upvote 0
Hello Colo... thanks for the response, but it is not making it do anything... I also tried the next cell (=nextcell) and tied your code to that next one but nothing still. any toughts? I copied the code under thisworkbook
 
Upvote 0
Hi there try this. The code works for the cell A1.

Private Sub Worksheet_Calculate()
Dim i As Integer
If [A1].Value >= 0 Then

For i = 1 To 11
Application.OnTime Now + TimeValue("00:00:0" & i), "Flash"
Next i
Else
[A1].Interior.ColorIndex = xlNone
End If

End Sub

Insert a module into the work book and add this code:

Private Sub Flash()

If [A1].Interior.ColorIndex = xlNone Then
[A1].Interior.ColorIndex = 3
GoTo fin
End If
If [A1].Interior.ColorIndex = 3 Then
[A1].Interior.ColorIndex = xlNone
End If
fin:

End Sub

This works for me. HTH
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,717
Members
448,985
Latest member
chocbudda

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