Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   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???

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default 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   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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command to make a forumula fron not running boxterduke Excel Discussion (Misc queries) 2 November 3rd 08 09:46 PM
How to make command buttons move among worksheets? Rick Excel Programming 6 July 21st 05 06:06 PM
Make more info appear when mouse moves over a macro command button Jeff at Bosch Corp. Excel Programming 1 May 25th 05 09:44 PM
How do I make a command button invisible or visible? Mandora Excel Programming 3 February 17th 05 08:40 PM
Make Command Button visible only in .xlt? RPIJG[_23_] Excel Programming 2 May 17th 04 07:14 PM


All times are GMT +1. The time now is 06:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"