Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why I need more then one End If ?
#1
Not Solved
Hello experts, I am new to IT and trying to learn to script but unable to understand why I need EndIf four times in below script at the end for it to work. I have been writing other ElseIf statements and used EndIf only once at end of script and they worked fine but this one is requiring it 4 times. ??

Quote:Dim State, Region
State=Inputbox ("Enter a State")
Region=Inputbox ("Enter a Region")

If state= "AP" Then
If Region= "Telangana" Then
msgbox "Hello Reddy"
msgbox "Dist count is 10"

Else if Region= "Rayalasema" Then
msgbox "Hello GCR"
msgbox "Dist count is 4"

Else If Region= "Costal" Then
msgbox "Hello mohan"
msgbox "Dist count is 9"

End If
End If
End If
End If
Reply
#2
Not Solved
ElseIf should be one word (without space)....
Thanks,
SUpputuri
Reply
#3
Not Solved
Thanks Supputuri ji.

Also, Please tell me why needed EndIf 4 times at end ? Thanks.
Reply
#4
Not Solved
Actually we dont need 4 End If, check the below code.
PHP Code:
Dim StateRegion
State
=Inputbox ("Enter a State")
Region=Inputbox ("Enter a Region")
If 
state"AP" Then
    
If Region"Telangana" Then
        msgbox 
"Hello Reddy"
        
msgbox "Dist count is 10"
    
Elseif Region"Rayalasema" Then
        msgbox 
"Hello GCR"
        
msgbox "Dist count is 4"
    
ElseIf Region"Costal" Then
        msgbox 
"Hello mohan"
        
msgbox "Dist count is 9"
    
End If
End If 
Thanks,
SUpputuri
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  End Loop wheelercha 2 2,844 12-18-2009, 12:19 AM
Last Post: wheelercha
  How to use Excel sheet in the back end? ttz 1 2,855 09-08-2008, 02:46 PM
Last Post: Ankur

Forum Jump:


Users browsing this thread: 1 Guest(s)