View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
homer homer is offline
external usenet poster
 
Posts: 47
Default How to work multiple ifs

Please ignore the previous most with the same name, something went goofy when
I tried to post. Is there any way to delete the first post?

What I am looking to do is call one of three macros depending on the
contents of a cell. If I have my code to look like below, the second macro
is run regardless if it is true or not.

Sub Special_Terms()
If AH13 = AH6 Then
Call Special_Terms_Frank
If AH13 = AH7 Then
Call Special_Terms_Jack
Else
Call Delete_Special_Terms
End If
End If
End Sub

If I change the code that is below, it returns the first macro regardless of
it being true.

Sub Special_Terms()
If AH13 = AH6 Then
Call Special_Terms_Frank
ElseIf AH13 = AH7 Then
Call Special_Terms_Jack
Else
Call Delete_Special_Terms
End If
End Sub


Can anyone explain what the difference in each of the two options above and
how do I make only the true macro run?