3. Conditional Statements In Excel VBA: 3 Ways!
How are you with conditional statements in Excel VBA? We'll see in this session!
Conditional (IF) statements are an essential part of Excel VBA routines, and of coding structures more generally. A conditional statement checks if something is happening (if a 'condition' is met) then takes the code in one of two or more directions. You could compare it to the IF formula in the Excel worksheet. In the context of football data, conditional statements allow us, for example, to distinguish between home and away teams.
In this session, I show you the 3 constructs I use to articulate all conditional statements in Excel VBA, from a simple 'one-line' if statement, to the supremely powerful 'Select Case' construct. For the purpose of form analysis, these powerful constructs allow us to translate the '1X2' data to W, L or D.
Also look out for some cool position control ideas using .Offset and .Cells (which is your favourite?)
Tools And Techniques
- Simple one-line IF statement
- If-Else-End if
- Select Case
-.Offset
-.Cells
Conditional (IF) statements are an essential part of Excel VBA routines, and of coding structures more generally. A conditional statement checks if something is happening (if a 'condition' is met) then takes the code in one of two or more directions. You could compare it to the IF formula in the Excel worksheet. In the context of football data, conditional statements allow us, for example, to distinguish between home and away teams.
In this session, I show you the 3 constructs I use to articulate all conditional statements in Excel VBA, from a simple 'one-line' if statement, to the supremely powerful 'Select Case' construct. For the purpose of form analysis, these powerful constructs allow us to translate the '1X2' data to W, L or D.
Also look out for some cool position control ideas using .Offset and .Cells (which is your favourite?)
Tools And Techniques
- Simple one-line IF statement
- If-Else-End if
- Select Case
-.Offset
-.Cells
3 Lessons