IF THEN ELSE on MAC

Questions ArchiveCategory: ProgrammingIF THEN ELSE on MAC
Martin asked 2 years ago

So I’ve been getting an error message when i try to use IF THEN ELSE functions on the else it always see the messaging saying I’m missing if, even if i wanted everything else to follow the instruction. When i try to use a else if I’m gettinng another error. I’m on a Mac so i assume that has something to do with it. I’ve been bypassing it most times by just writing another IF THEN and then ending the macro, but i know for more complicated macros I’ll want the ability to do else and else if

Jordan P Mack replied 2 years ago

Hi Martin,

I think you could have a few possible errors. Make sure you have an End If for example:

If x < 10 Then
x = x + 1
Else
x = x – 1
End if

Another possible error is that you have lines after Then like

If x < 10 Then x = x + 1
Else: x = x – 1
End if

This does not work for the Then. the sentence after Else is fine as long as you have the colon but the code after then like such will not work.

It could be as well that you made Else If two words when it should be one.

If x 50 Then
x = 0
Else: x = x – 1
End if

Hope this helps

1 Answers
Jordan P Mack answered 2 years ago

Hi Martin,
I think you could have a few possible errors. Make sure you have an End If for example:
If x < 10 Then
x = x + 1
Else
x = x – 1
End if
Another possible error is that you have lines after Then like
If x < 10 Then x = x + 1
Else: x = x – 1
End if
This does not work for the Then. the sentence after Else is fine as long as you have the colon but the code after then like such will not work.
It could be as well that you made Else If two words when it should be one.
If x < 10 Then
     x = x + 1
ElseIf x < 50 Then
     x = 0
Else: x = x – 1
End if
Hope this helps

Your Answer

11 + 1 =

css.php