If Else problem in an excel macro

Solved/Closed
marlabt - Mar 1, 2010 at 04:50 PM
 marlabt - Mar 4, 2010 at 10:37 AM
Hello,

I have been trying to program a simple imbeded IF Else statement in Excel and it keeps throwing a Else without IF error. What am I missing

Sheets("Account Numbers").Select
Range("A3:D3").Select
Selection.Copy
Sheets("Fax Sheet").Select
If Range("B2") = 0 Then Range("A2").Select
ActiveSheet.Paste
Else: Range("A3").Select
Related:

4 responses

It is still throwing the "Else without If" statement. What do I do now? Help please


If Range("B2") = 0 Then Range("A3").Select
ActiveSheet.Paste
Else
Range("A2").Select
ActiveSheet.Paste
End If
1
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Mar 4, 2010 at 09:54 AM
Your problem is this

If Range("B2") = 0 Then Range("A3").Select

move
Range("A3").Select
to a next line

so it looks like

If Range("B2") = 0 Then
Range("A3").Select
1
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Mar 2, 2010 at 02:42 AM
If Range("B2") = 0 Then
Range("A2").Select
ActiveSheet.Paste

Else
Range("A3").Select
end if
0
Thanks much!!!!!!!!!!!!!!!
0