Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Flashing - using Format Condition/If and Macro How ??

Status
Not open for further replies.

sbunnag

Programmer
Jan 27, 2005
2
US
In MS Excel, I have question, how can I make a cell flashing with Red color if condition are met, Say

at cell A1 is =279
B1 is =12
I want to exam cell A1 if the B1 is > 10 and A1 < 280 then
make cell A1 flashing with the Red color ( I am reading real time data and calculate a value in cell B1 and read A1 as real time data) Using Format condition and Macro. I don't
how to activate macro automaticlly, if both condition are met.

Thanks,
S. Bunnag
 
Hi,

You have to use an EVENT. An event could be when the user pushes a button -- the button_click event.

However, in this case, you probably want the event to be whenever the user changes a value in the sheet. This is the Worksheet_Change event.

Right click the sheet tab and select View Code

Select Worksheet in the Object dropdown.

Select Change in the Procedure dropdown. Call your macro from here.

Skip,

[glasses] [red]Be advised:[/red] Researchers have found another Descartes trueism, "Cogito ergo spud."
"I think; therefore, I YAM!
[tongue]
 
Insert name "Test" and assign, say, TRUE to it.
Insert module and paste:

Public bTest As Boolean
Sub changeB()
bTest = Not bTest
If bTest Then
ThisWorkbook.Names("Test").RefersTo = "=TRUE"
Else
ThisWorkbook.Names("Test").RefersTo = "=FALSE"
End If
'Debug.Print bTest
Application.OnTime Now + TimeValue("00:00:01"), "ChangeB"
End Sub

Run the macro, in conditional formatting use "formula is" option, with combination of TEST, this flashes all the time:
=(Test=TRUE)

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top