As part of a longer code I am trying to assign specific a staff name to each row based on an two dimensional alphabet assignment array. LastRow has been declared and picks up correctly but the loop still stops after 27 loops regardless. How can this be corrected to continue through to the LastRow? This is my first time working with multi-dimensional arrays so I greatly appreciate any assistance.
Private Sub Assignments()
Dim Alpha As Variant, Staff As Variant
Dim i As Integer
Dim LastRow As Long
Dim alpha_Assignment(1 To 26, 1 To 2) As Variant
'define last row
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
'set alpha column to array and set staff to array
Alpha = Range("AB2:AB" & LastRow).Value
Staff = Range("AC2:AC" & LastRow).Value
'Array Values to Alpha and Assigned staff
alpha_Assignment(1, 1) = "A"
alpha_Assignment(1, 2) = "Staff 1"
alpha_Assignment(2, 1) = "B"
alpha_Assignment(2, 2) = "Staff 2"
alpha_Assignment(3, 1) = "C"
alpha_Assignment(3, 2) = "Staff 3"
'and so on for all 26 letters in alphabet then loop statement and paste into worksheet.
For i = 1 To UBound(alpha_Assignment)
If Alpha(i, 1) = alpha_Assignment(i, 1) Then
Staff(i, 1) = alpha_Assignment(i, 2)
ElseIf Alpha(i, 1) <> alpha_Assignment(i, 1) Then
Staff(i, 1) = "Staff 1"
End If
Next i
Range("AC2").Resize(UBound(Staff, 1), 1).Value = Staff
End Sub