variable vba code example
Example 1: vba declare variable with value
Dim myString As String: myString = "aaa bbb"
Dim myStringCaps As String: myStringCaps = UCase("aaa bbb")
Dim myPart As Variant: myPart = Split(myString)
Dim ws As Worksheet: Set ws = ThisWorkbook.Worksheets(1)
Const MY_CONST As String = "Value"
Example 2: vba type variable
debug.print TypeName(my_var) ' String, Integer, Date...
debug.print VarType(my_var) ' vbLong, vbDate...