Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
If Then statement in macro gone wrong
Can anyone tell me whats wrong with the below? It keeps returning the
message "Compile Error: Else without If", when it gets to 'ActiveCell', on the 2nd line... If ActiveCell = "" Then Selection.Rows.Hidden = True Else: If ActiveCell = "Blah Blah Blah" Then Selection.Rows.RowHeight = 25.5 Else: Selection.Rows.AutoFit End If |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
If Then statement in macro gone wrong
Since VBA allows you to put If/Then on the same line, the Else is being
treated as its own statement. If ActiveCell = "" Then Selection.Rows.Hidden = True Elseif ActiveCell = "Blah Blah Blah" Then Selection.Rows.RowHeight = 25.5 Else: Selection.Rows.AutoFit End If "ellmcg" wrote: Can anyone tell me whats wrong with the below? It keeps returning the message "Compile Error: Else without If", when it gets to 'ActiveCell', on the 2nd line... If ActiveCell = "" Then Selection.Rows.Hidden = True Else: If ActiveCell = "Blah Blah Blah" Then Selection.Rows.RowHeight = 25.5 Else: Selection.Rows.AutoFit End If |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
If Then statement in macro gone wrong
Thanks! I'd tried tweaking the layout in so many ways, but hadn't been able
to get the right one... "JMB" wrote: Since VBA allows you to put If/Then on the same line, the Else is being treated as its own statement. If ActiveCell = "" Then Selection.Rows.Hidden = True Elseif ActiveCell = "Blah Blah Blah" Then Selection.Rows.RowHeight = 25.5 Else: Selection.Rows.AutoFit End If "ellmcg" wrote: Can anyone tell me whats wrong with the below? It keeps returning the message "Compile Error: Else without If", when it gets to 'ActiveCell', on the 2nd line... If ActiveCell = "" Then Selection.Rows.Hidden = True Else: If ActiveCell = "Blah Blah Blah" Then Selection.Rows.RowHeight = 25.5 Else: Selection.Rows.AutoFit End If |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
What's wrong with this if statement? | Excel Discussion (Misc queries) | |||
IF Statement help please - again - got it wrong last time! | Excel Worksheet Functions | |||
wts wrong with this statement | Excel Worksheet Functions | |||
What is wrong with this IF statement? need help. | Excel Discussion (Misc queries) | |||
What's wrong with this SQL join statement???? | Excel Programming |