automatic replacing of a VBE sub in all open workbooks

P

pls123

hi all !
i know how to make automatic replacing of a cell for all open workbooks..

now i neeed to replace a sub with another 1 with a little difference..

is there a way to make it ?
tx !
 
J

JLGWhiz

You can write another Sub procedure and call it from a third procedure based
on conditions:

Sub master()
If Range("A1") <> "Condition" Then
Macro1
Else
Macro2
End If
End Sub

Sub Macro1()
MsgBox "Macro1"
Range("A1") = "Condition")
End Sub

Sub Macro2
MsgBox "Macro2"
Range("1").ClearContents
End Sub
 
P

pls123

tx for help !


JLGWhiz said:
You can write another Sub procedure and call it from a third procedure based
on conditions:

Sub master()
If Range("A1") <> "Condition" Then
Macro1
Else
Macro2
End If
End Sub

Sub Macro1()
MsgBox "Macro1"
Range("A1") = "Condition")
End Sub

Sub Macro2
MsgBox "Macro2"
Range("1").ClearContents
End Sub





.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top