View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default 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