Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
is it possible to run a macro using a cell reference?
TIA - everyone that helps in this group is awesome. thanks so much
for your help. i would like to know, and i can't find it in my books, if it is possible to run a macro when a cell returns a certain criteria. for example, if range("A1") = x then application.run "macro1" if so, where do i put the code? jasonk |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
is it possible to run a macro using a cell reference?
right click sheet tabview codeinsert thisSAVE
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$A$1" And UCase(Target) = "X" Then MsgBox "HI" End Sub -- Don Guillett SalesAid Software "JasonK" wrote in message ... TIA - everyone that helps in this group is awesome. thanks so much for your help. i would like to know, and i can't find it in my books, if it is possible to run a macro when a cell returns a certain criteria. for example, if range("A1") = x then application.run "macro1" if so, where do i put the code? jasonk |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
is it possible to run a macro using a cell reference?
What will make the value change?
If by editing use the Worksheet_Change event if by formula, use the Worksheet_Calculate event You get to these by right clicking on the sheet tab and selecting view code. In the resulting module, in the dropdowns at the top Left: Worksheet Right: Change (or Calculate) this places an event procedure definition in the module. In the Change event, the Target argument contains a reference to the cell that triggered the change (was edited usually). Calculate doesn't give you that information. Any cell that is changed by editing will trigger the Change event. So in the event, you put code to determine whether to react or not With calculate, you will need to determine whether you need to act or not. If it is something to do over and over, then no problem. But if you only want to do it once when the value changes, you will need to store information - perhaps in static variables. See Chip Pearson's page on events: http://www.cpearson.com/excel/events.htm -- Regards, Tom Ogilvy "JasonK" wrote: TIA - everyone that helps in this group is awesome. thanks so much for your help. i would like to know, and i can't find it in my books, if it is possible to run a macro when a cell returns a certain criteria. for example, if range("A1") = x then application.run "macro1" if so, where do i put the code? jasonk |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
is it possible to run a macro using a cell reference?
thank you gentlemen, i appreciate the help.
the first code didn't work for me, but after reading this response, i'm messing around with the advice and i believe i can make it work. thanks again, jasonk On Fri, 17 Mar 2006 14:10:27 -0800, Tom Ogilvy wrote: What will make the value change? If by editing use the Worksheet_Change event if by formula, use the Worksheet_Calculate event You get to these by right clicking on the sheet tab and selecting view code. In the resulting module, in the dropdowns at the top Left: Worksheet Right: Change (or Calculate) this places an event procedure definition in the module. In the Change event, the Target argument contains a reference to the cell that triggered the change (was edited usually). Calculate doesn't give you that information. Any cell that is changed by editing will trigger the Change event. So in the event, you put code to determine whether to react or not With calculate, you will need to determine whether you need to act or not. If it is something to do over and over, then no problem. But if you only want to do it once when the value changes, you will need to store information - perhaps in static variables. See Chip Pearson's page on events: http://www.cpearson.com/excel/events.htm |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro using a cell reference | Excel Discussion (Misc queries) | |||
Cell Reference Macro | Excel Discussion (Misc queries) | |||
cell reference using macro | Excel Programming | |||
Macro cell reference help | Excel Programming | |||
run a macro from a cell reference | Excel Programming |