Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
how can i use an if statement to run a macro?
if ( a1 = 1, run macro, " ")
what code do i need to use to do this? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
how can i use an if statement to run a macro?
Insert this code into your sheet and you should be good to go.
Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$A$1" And Target.Value = 1 Then Call MyMacro 'Insert the name of your macro here End If End Sub To add this to a sheet right click on the sheet tab - select view code -paste HTH "Jack" wrote: if ( a1 = 1, run macro, " ") what code do i need to use to do this? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
how can i use an if statement to run a macro?
Are you talkong about a worksheet formula that looks like what you posted? If
so, you can't "run a macro" that carries out actions on the worksheet. The "macro" can only be a VBA function that returns a value to the cell, just like SUM or AVERAGE do. On Thu, 3 Mar 2005 15:29:03 -0800, "Jack" wrote: if ( a1 = 1, run macro, " ") what code do i need to use to do this? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro if and / or statement | Excel Discussion (Misc queries) | |||
IF statement in macro | Excel Worksheet Functions | |||
can i use an IF Statement to run a macro? | Excel Worksheet Functions | |||
HELP w/ Macro and IF Statement | Excel Programming | |||
If-statement in Macro | Excel Programming |