![]() |
If Then Statements
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? |
If Then Statements
Figured it out. Had to move all after THEN to next line.
"Wally Steadman" wrote in message ... 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? |
If Then Statements
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) "Wally Steadman" wrote in message ... Figured it out. Had to move all after THEN to next line. "Wally Steadman" wrote in message ... 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? |
If Then Statements
You got it...
If Then Else can get very complex even on a single line. I have such an example on my website. -- Rob van Gelder - http://www.vangelder.co.nz/excel "Wally Steadman" wrote in message ... Figured it out. Had to move all after THEN to next line. "Wally Steadman" wrote in message ... 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? |
All times are GMT +1. The time now is 05:14 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com