Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
can you make an IF command run a macro???
Hey guys, I need to get a macro (macro name is Superscript) to run automaticly i the total of cell U18 = 2 Can I do it with an if command expample: =if(U18=2, "???", " ") ??? = run superscript or I"m a newb at VB... could someone supply me with a VB script to d this -- bigtonyic ----------------------------------------------------------------------- bigtonyicu's Profile: http://www.excelforum.com/member.php...fo&userid=2243 View this thread: http://www.excelforum.com/showthread.php?threadid=47824 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
can you make an IF command run a macro???
you could use worksheet event code. right click on your worksheet, select
view code, and paste following into the code window that appears. Private Sub Worksheet_Change(ByVal Target As Range) If Range("U18").Value = 2 Then Call macro1 End Sub where macro1 is the name of your macro. or, you can incorporate your macro code into this worksheet event handler instead of calling the macro. "bigtonyicu" wrote: Hey guys, I need to get a macro (macro name is Superscript) to run automaticly if the total of cell U18 = 2 Can I do it with an if command expample: =if(U18=2, "???", " ") ??? = run superscript or I"m a newb at VB... could someone supply me with a VB script to do this. -- bigtonyicu ------------------------------------------------------------------------ bigtonyicu's Profile: http://www.excelforum.com/member.php...o&userid=22430 View this thread: http://www.excelforum.com/showthread...hreadid=478242 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
can you make an IF command run a macro???
Just a guess but that probably wil not work based on your description that
U18 = 2. If U 18 is a formula then the on change code needs to catch changes to the cells that are the precidents of the formula in U18. For exampl if U18 is the sum of S18 and T 18 then you need to catch changes to S18 or T18 and then evaluate the value of U18. It is a bit more effort but it should work... -- HTH... Jim Thomlinson "JMB" wrote: you could use worksheet event code. right click on your worksheet, select view code, and paste following into the code window that appears. Private Sub Worksheet_Change(ByVal Target As Range) If Range("U18").Value = 2 Then Call macro1 End Sub where macro1 is the name of your macro. or, you can incorporate your macro code into this worksheet event handler instead of calling the macro. "bigtonyicu" wrote: Hey guys, I need to get a macro (macro name is Superscript) to run automaticly if the total of cell U18 = 2 Can I do it with an if command expample: =if(U18=2, "???", " ") ??? = run superscript or I"m a newb at VB... could someone supply me with a VB script to do this. -- bigtonyicu ------------------------------------------------------------------------ bigtonyicu's Profile: http://www.excelforum.com/member.php...o&userid=22430 View this thread: http://www.excelforum.com/showthread...hreadid=478242 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
can you make an IF command run a macro???
Ignore my last post. That code will work... I thought that JMB was checking
the value of the target. I am loosing it... -- HTH... Jim Thomlinson "JMB" wrote: you could use worksheet event code. right click on your worksheet, select view code, and paste following into the code window that appears. Private Sub Worksheet_Change(ByVal Target As Range) If Range("U18").Value = 2 Then Call macro1 End Sub where macro1 is the name of your macro. or, you can incorporate your macro code into this worksheet event handler instead of calling the macro. "bigtonyicu" wrote: Hey guys, I need to get a macro (macro name is Superscript) to run automaticly if the total of cell U18 = 2 Can I do it with an if command expample: =if(U18=2, "???", " ") ??? = run superscript or I"m a newb at VB... could someone supply me with a VB script to do this. -- bigtonyicu ------------------------------------------------------------------------ bigtonyicu's Profile: http://www.excelforum.com/member.php...o&userid=22430 View this thread: http://www.excelforum.com/showthread...hreadid=478242 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
can you make an IF command run a macro???
That's OK, you bring up a good point about the cell being linked or the
result of a calculation. I think the code will not work if the cell is linked to another worksheet, in which case the OP would have to check the precedents on the other sheet(s). "Jim Thomlinson" wrote: Ignore my last post. That code will work... I thought that JMB was checking the value of the target. I am loosing it... -- HTH... Jim Thomlinson "JMB" wrote: you could use worksheet event code. right click on your worksheet, select view code, and paste following into the code window that appears. Private Sub Worksheet_Change(ByVal Target As Range) If Range("U18").Value = 2 Then Call macro1 End Sub where macro1 is the name of your macro. or, you can incorporate your macro code into this worksheet event handler instead of calling the macro. "bigtonyicu" wrote: Hey guys, I need to get a macro (macro name is Superscript) to run automaticly if the total of cell U18 = 2 Can I do it with an if command expample: =if(U18=2, "???", " ") ??? = run superscript or I"m a newb at VB... could someone supply me with a VB script to do this. -- bigtonyicu ------------------------------------------------------------------------ bigtonyicu's Profile: http://www.excelforum.com/member.php...o&userid=22430 View this thread: http://www.excelforum.com/showthread...hreadid=478242 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Command to make a forumula fron not running | Excel Discussion (Misc queries) | |||
How to make command buttons move among worksheets? | Excel Programming | |||
Make more info appear when mouse moves over a macro command button | Excel Programming | |||
How do I make a command button invisible or visible? | Excel Programming | |||
Make Command Button visible only in .xlt? | Excel Programming |