How do i insert "If function" in a macro?

  • Thread starter Thread starter madcat
  • Start date Start date
M

madcat

I have a recorded macro and i would like to insert a condition, if "Y
then copy ove
 
madcat

Note IF statement tests are case sensitive

if range("a2") = "Y" then
do something
end if


or

if range("a2") = "Y" then
do something
elseif range("b3")="N" then
do something else
else
do some other thing
end if


you can also use Select Case

Select case range("a1")
case "Y"
do something
case "N"
do somr other thing
case "T"
do something else
end selec
 

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

Back
Top