MACRO LIBRARY

Lesson 1.5 - for - next loop code

Free public access. No account or subscription required.

Files

Lesson 1.5 - for - next loop code

Code

Dim strFirstName(2) As String
Dim strLastName(2) As String
Dim strFullName(2) As String
Dim i As Integer
    
Sub main()
    strFirstName(0) = "Albert"
    strLastName(0) = "Einstein"
    
    strFirstName(1) = "Nikola"
    strLastName(1) = "Tesla"
    
    strFirstName(2) = "Thomas"
    strLastName(2) = "Edison"
    
    For i = 0 To UBound(strFirstName)
        strFullName(i) = strFirstName(i) & " " & strLastName(i)
        MsgBox strFullName(i)
    Next i
End Sub