run macro only if condition is met

N

Nikonov

I need to run a macro (copy one cell into another) only if a certain
condition is met. For example, if x=a, then run this macro. If not, do
something else.
 
G

Gary''s Student

Sub Macro1()
If Cells(1, 1) = 1 Then
Exit Sub
Else
MsgBox ("HI")
End If
End Sub
 
D

Don Guillett

Didn't you answer it

if x="a" then
run thismacro
else
do something else
end if
 

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