LtB
09-06-2012, 03:15 AM
I'm having a problem...
In a VBA reference I find
Finally, let's take a look at an example that uses Else.
If LRegion ="N" Then
LRegionName = "North"
ElseIf LRegion = "S" Then
LRegionName = "South"
ElseIf LRegion = "E" Then
LRegionName = "East"
Else
LRegionName = "West"
End If
I do not need the two elseIf parts.
When I use only if... ten..., everything is OK.
When I cntinue with else..... end if part , I get a compiler Error: "Else without If"
Between Else and End If I have two nested Case statements, like this:
If LRegion ="N" Then
correct code
Else
Select Case test_expression
Case condition_1
result_1
Case condition_2
result_2
...
Case condition_n
Select Case test_expression2
Case condition_1
result_1
Case condition_2
result_2
...
Case condition_n
result_n
End Select
End Select
End If
These case constructions compile well (also nested) when not entangled in a else.. end if
What can be the matter?
Too deep nesting level? that cannot be possible with only 3 levels...
(Excel 2007, Windows 7, both Dutch localised)
In a VBA reference I find
Finally, let's take a look at an example that uses Else.
If LRegion ="N" Then
LRegionName = "North"
ElseIf LRegion = "S" Then
LRegionName = "South"
ElseIf LRegion = "E" Then
LRegionName = "East"
Else
LRegionName = "West"
End If
I do not need the two elseIf parts.
When I use only if... ten..., everything is OK.
When I cntinue with else..... end if part , I get a compiler Error: "Else without If"
Between Else and End If I have two nested Case statements, like this:
If LRegion ="N" Then
correct code
Else
Select Case test_expression
Case condition_1
result_1
Case condition_2
result_2
...
Case condition_n
Select Case test_expression2
Case condition_1
result_1
Case condition_2
result_2
...
Case condition_n
result_n
End Select
End Select
End If
These case constructions compile well (also nested) when not entangled in a else.. end if
What can be the matter?
Too deep nesting level? that cannot be possible with only 3 levels...
(Excel 2007, Windows 7, both Dutch localised)