inurface
03-24-2021, 12:58 AM
Hi everyone,
First post here, I am trying to write a VBA that can lookup the value in sheet"ac mapping" to sheet "status run", but some error occur, can anyone help check if anything goes wrong?
Sub lookupac()
Dim lastrowB As Long
lastrowB = Cells(Sheets("status run").Rows.Count, "N").End(xlUp).Row
Set acmapping = Sheets("ac mapping").Range("A:B")
For i = 2 To lastrowB
Cells(i, 15) = Worksheet.Application.WorksheetFunction.VLookup(Cells(i, 2), acmapping, 2, False)
Next i
End Sub
First post here, I am trying to write a VBA that can lookup the value in sheet"ac mapping" to sheet "status run", but some error occur, can anyone help check if anything goes wrong?
Sub lookupac()
Dim lastrowB As Long
lastrowB = Cells(Sheets("status run").Rows.Count, "N").End(xlUp).Row
Set acmapping = Sheets("ac mapping").Range("A:B")
For i = 2 To lastrowB
Cells(i, 15) = Worksheet.Application.WorksheetFunction.VLookup(Cells(i, 2), acmapping, 2, False)
Next i
End Sub