If Then Statements

  • Thread starter Thread starter Wally Steadman
  • Start date Start date
W

Wally Steadman

I have this simple code:

sub printsheet()

If Worksheets(1).Cells(1, 1) <> " " Then Worksheets(1).printout

End If

end sub

I keep getting a COMPILE ERROR: End If without Block if.

My If Then syntax appears to be coorect based on the help file, what am I
doing wrong?
 
or remove the End If.

You only need End If for multi-line statements, if all on one line, no need.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
You got it...
If Then Else can get very complex even on a single line.
I have such an example on my website.
 

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

Similar Threads


Back
Top