[RESOLVED] !!!!!!!Need Some Help !!!!!!Urget
I need a little help with my code , If the statment is true I want it to stop the code at the end if what should I use in the place of the 'end if'?
Private Sub Command20_Click()
If Check1 = 1 Then 'if this is true i want it to stop
Check1 =0
Check2 = 1
End If 'here
If Check2 = 1 Then
check2 = 0
Check3 = 1
End If
If Check3 = 1 Then
Check3 = 0
check4 = 1
End If
End Sub
Re: !!!!!!!Need Some Help !!!!!!Urget
Use nested If Else statements.
VB Code:
Private Sub Command20_Click()
If Check1 = 1 Then 'if this is true i want it to stop
Check1 =0
Check2 = 1
Else
If Check2 = 1 Then
Check2 = 0
Check3 = 1
End If
If Check3 = 1 Then
Check3 = 0
check4 = 1
End If
End If
End Sub
Or ElseIf statements
VB Code:
Private Sub Command20_Click()
If Check1 = 1 Then 'if this is true i want it to stop
Check1 =0
Check2 = 1
ElseIf Check2 = 1 Then
Check2 = 0
Check3 = 1
ElseIf Check3 = 1 Then
Check3 = 0
check4 = 1
End If
End Sub
Re: !!!!!!!Need Some Help !!!!!!Urget
Or you may use Exit Sub/Function statement
VB Code:
If Check1 = 1 Then 'if this is true i want it to stop
Check1 = 0
check2 = 1
Exit Sub
End If 'here
If check2 = 1 Then
check2 = 0
Check3 = 1
End If
If Check3 = 1 Then
Check3 = 0
check4 = 1
End If
End Sub
Pradeep :)