Hello,
Is there any way I can run a macro depends on the value of a cell.
For Eg: If the value in A1=1 then run macro5, if the value in A1=2 then run macro3
Thanks in Advance
Toms
Hello,
Is there any way I can run a macro depends on the value of a cell.
For Eg: If the value in A1=1 then run macro5, if the value in A1=2 then run macro3
Thanks in Advance
Toms
Hi,Originally Posted by SMILE
In the Worksheet code window,
and in Module1![]()
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub If Target.Address = "$A$1" Then If Target.Value = 1 Then Module1.macro1 Else If Target.Value = 2 Then Module1.macro2 End If End If End If End Sub
hth![]()
Sub macro1() MsgBox 1 End Sub Sub macro2() MsgBox 2 End Sub
---
Si fractum non sit, noli id reficere.
Bryan
you are genius !!!!!!!!!!!!!
Thanks a lot... I got what I wanted...
Toms
Good to see it worked for you, and thanks for the response.Originally Posted by SMILE
---
Bryan
just to know, what the following line does in the program ????
If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
thanks
toms
Hi,Originally Posted by SMILE
it checks to see if more than a single cell triggered the code, or if the cell is empty, in either case nothing is required to happen.
hth
---
thank you!!!!!!!!!!!!!!!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks