I have the following code:


Function GetPersonId(personName As String) As Integer
    Dim n As String, pl, i As Long
    GetPersonId = 0
    n = Trim(personName)
    pl = Worksheets("PERSON_LOOKUP").Range("a1").CurrentRegion
    For i = 2 To UBound(pl, 1)
        If Trim(pl(i, 2)) = n Then
            GetPersonId = pl(i, 1)
            Exit For
        End If
    Next
End Function

Sub PopulateReportCreatedByIds()
    Dim a, i As Long
    a = Worksheets("REPORT").Range("a1").CurrentRegion
    For i = 2 To UBound(a, 1)
        Worksheets("REPORT").Cells(i, 27).Value = GetPersonId(a(i, 28).Text)
    Next
End Sub
When I run this, i get "Run-time error '424': Object required" on the line where the function is called. I've tried .Text, .Value, and just the cell itself, and they all get an error.

Need help!

Thanks!