Hi,
I am very much a beginner at VBA and I am trying to use a VLookup and it keeps erroring and (I am not sure why). I have 2 sheets one called COMBINED and the other called HRIS.
1) I want to take a Staff ID in COMBINED tab and find the corresponding ID in the HRIS file
2) Check the nationality for that person (which is in a different column of HRIS tab)
3) Once done, I want to update the Nationality column in the COMBINED File if the existing value is blank
The values I am looking for do exist in the HRIS tab.
I am using a VLookup to do this, but at the moment it keeps failing to get Run Error 1004 or Error Method Vlookup of Object Worksheet Function failed.
The relevant lines of the code is as follows:
I am very much a beginner at VBA and I am trying to use a VLookup and it keeps erroring and (I am not sure why). I have 2 sheets one called COMBINED and the other called HRIS.
1) I want to take a Staff ID in COMBINED tab and find the corresponding ID in the HRIS file
2) Check the nationality for that person (which is in a different column of HRIS tab)
3) Once done, I want to update the Nationality column in the COMBINED File if the existing value is blank
The values I am looking for do exist in the HRIS tab.
I am using a VLookup to do this, but at the moment it keeps failing to get Run Error 1004 or Error Method Vlookup of Object Worksheet Function failed.
The relevant lines of the code is as follows:
VBA Code:
strNationality = Application.WorksheetFunction.VLookup(strStaffID, Sheets("HRIS").Range("G2:Z500"), 10, False)
If Sheets("COMBINED").Range("S" & i).Value = "" Then
Sheets("COMBINED").Range("S" & i).Value = strNationality
Else
End If