1.1. If Else
VBA If Statements allow you to test if expressions are TRUE or FALSE, running different code based on the results. Let’s look at a simple example.
Note
There three condition and statement. The third condition in <else>
don't need to be called in the syntax.
5.1 Define The Table
Define Table Earliest and Latest Cell (UpperLeft and LowerRight), Then retrieve the properties. Example Range (B2:F7)
Now we have four new reference here
- Table 1 Variable First
T1V1
.
- Table 1 Variable Last
T1VL
.
- Table 1 Observation First
T1O1
.
- Table 1 Observation Last
T1OL
.
5.2 Define The Variables
Define The Variables to get its Range (Header). We'll use it to find variable based on its name (values). Example (B2:F2)
Now we have A new reference here
- Header in Table 1
H1
.
5.3 Example
How to select all cell (values) from a single variable (column). example Range(C3:C7) ?
- Search Variable's Cell in Header
H1
, then return the cell (row and column) number.
- Retrieve our target properties, Range
C3:C7
.
- Get
C3:C7
formula
- Create a code !