Thread: End If
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JulieD JulieD is offline
external usenet poster
 
Posts: 618
Default End If

Hi

it depends on how you write the IF statement
a single line IF doesn't need an End IF
e.g.

IF Range("A1").value = 1 Then Exit Sub

needs no End If (and doens't want one)

however, if you write it as follows

If Range("A1").value = 1 Then
Exit Sub

you need an End If (the code won't run without).

hope this helps
Cheers
JulieD

"aksel børve" wrote in message
...
I use the "If" on many of my codes, But when I try to write "End If" after
the code, A message tell me that i can't "End If" without "Block If". Why?
and Is there any reason to "End If" when the code works without?
Thank You
Aksel