|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
if syntax
I am new to VB.
I have if statement like If SecondSet = False Then Range("N" & RowNo & "").Select Else Range("AG" & RowNo & "").Select Else Range("T" & RowNo & "").Select End If ActiveCell.FormulaR1C1 = RecCount In the second else I am getting error, I do not want to use else if in the first else, how to use else twice? Thanks Jaco |
|
#2
|
||||
|
||||
|
SecondSet can only be True or False so how can you have three different possible actions to follow?
That doesn't make any logical sense. If/Else is a "one way or the other" kind of condition. If you have more than two possibilities then you have to have an "if else" or use a "select case" statement. |
|
#3
|
|||
|
|||
|
one "else" per "if" allowed with most logic, its either true or false... if you are comparing a variable with more than "true/false" such as an integer or string then use "Select Case"
I'm a newbe, but logic is logic, else its not logic, else it might be logic, else i'm getting confused... |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > if syntax |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|