Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
if then statements | Excel Worksheet Functions | |||
IF Statements (Mutliple Statements) | Excel Worksheet Functions | |||
if and or statements | Excel Discussion (Misc queries) | |||
IF & AND statements | Excel Worksheet Functions | |||
If then statements | Excel Worksheet Functions |