Archive of Mr Excel Message Board

| Check out our Excel VBA Resources | ||||
![]() |
![]() |
![]() |
![]() |
![]() |
Sub FlashBack()
'Make cell range Background color, flash x times, x fast, in x color,
'when Ctrl-a is pressed, if assigned as a macro option.
Dim newColor As Integer
Dim myCell As Range
Dim x As Integer
Dim fSpeed
'Make this cell range background flash!
Set myCell = Range("A1:A2")
Application.DisplayStatusBar = True
Application.StatusBar = "... Select Cell to Stop and Edit or Wait for Flashing to Stop! "
'Make cell background flash to this color!
'Black 25, Magenta 26, Yellow 27, Cyan 28, Violet 29, Dark Red 30,
'Teal 31, Blue 32, White 2, Red 3, Light Blue 41, Dark Blue 11,
'Gray-50% 16, Gray-25% 15, Bright Cyan 8.
newColor = 27
'Make the cell range flash fast: 0.01 to slow: 0.99
fSpeed = 0.2
'Make cell flash, this many times!
Do Until x = 35
'Run loop!
DoEvents
Start = Timer
Delay = Start + fSpeed
Do Until Timer > Delay
DoEvents
myCell.Interior.ColorIndex = newColor
Loop
Start = Timer
Delay = Start + fSpeed
Do Until Timer > Delay
DoEvents
myCell.Interior.ColorIndex = xlNone
Loop
x = x + 1
Loop
Application.StatusBar = False
Application.DisplayStatusBar = Application.DisplayStatusBar
End Sub
Sub FlashFont()
'Make cell range font flash, x times, x fast, in x color,
'when Ctrl-z is pressed.
Dim newColor As Integer
Dim myCell As Range
Dim x As Integer
Dim fSpeed
'Make this cell range font flash!
Set myCell = Range("A1:A2")
Application.DisplayStatusBar = True
Application.StatusBar = "... Select Cell to Stop and Edit or Wait for Flashing to Stop! "
'Make cell font flash to this color!
'Black 25, Magenta 26, Yellow 27, Cyan 28, Violet 29, Dark Red 30,
'Teal 31, Blue 32, White 2, Red 3, Light Blue 41, Dark Blue 11,
'Gray-50% 16, Gray-25% 15, Bright Cyan 8.
newColor = 3
'Make the cell range flash fast: 0.01 to slow: 0.99
fSpeed = 0.3
'Make cell flash, this many times!
Do Until x = 20
'Run loop!
DoEvents
Start = Timer
Delay = Start + fSpeed
Do Until Timer > Delay
DoEvents
myCell.Font.ColorIndex = newColor
Loop
Start = Timer
Delay = Start + fSpeed
Do Until Timer > Delay
DoEvents
myCell.Font.ColorIndex = xlAutomatic
Loop
x = x + 1
Loop
Application.StatusBar = False
Application.DisplayStatusBar = Application.DisplayStatusBar
End Sub
Sub reSetFlash()
'Re-set cell range color if edit break on color, Ctrl-r to re-set!
ActiveCell.Select
Selection.Interior.ColorIndex = xlNone
End Sub

Private Sub Worksheet_SelectionChange(ByVal
Target As Excel.Range)
If Not Intersect(Target, Range("B12:H22")) Is Nothing Then
If Target.Interior.ColorIndex = 34 Then
Target.Interior.ColorIndex = 0
Else
Target.Interior.ColorIndex = 34
End If
End If
End Sub

Sub YellowRow()
'Code by Jow Was
'At cursor, select Row, color Yellow.
ActiveCell.Select
'Color Row Yellow.
With Selection.EntireRow.Interior
.ColorIndex = 6
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
End Sub
This will conditionally change a cell in a range to a different background color and back based upon a condition. It must be placed in the tab sheet code and the name must not be changed or it will fail. JSW Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) : I don't think you can do a flash with a conditional format, but you can do it with code. Below is a set of macros to do a variety of flashes. The codes below use loops. I have others that work on cell conditions and "tab sheet codes." JSW : Sub FlashBack()

Sub YellowRow()
'Code by Jow Was
'At cursor, select Row, color Yellow.
ActiveCell.Select
'Color Row Yellow.
With Selection.EntireRow.Interior
.ColorIndex = 6
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
End Sub
This will conditionally change a cell in a range to a different background color and back based upon a condition. It must be placed in the tab sheet code and the name must not be changed or it will fail. JSW Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) : I don't think you can do a flash with a conditional format, but you can do it with code. Below is a set of macros to do a variety of flashes. The codes below use loops. I have others that work on cell conditions and "tab sheet codes." JSW : Sub FlashBack()
