Hiya,
I know there's tons of examples of this online, but I've looked & can't for the life of me work out why my vlookup won't work. Here's my code:
Dim SC As Integer
Dim SN As String
SC = Range("S_Code").Value
SN = Application.WorksheetFunction.VLookup(SC, Range("S_Code_R"), 2, False)
SN is to be used to set the value of cell "S_Name".
I've tried it using Range("S_Code").Value, Range("S_Code"), "S_Code", S_Code in place of the SC but it keeps coming up with the error:
Method 'Range' of object '_Worksheet' failed
SC does have a value & is definitely included in the S_Code_R range
Any suggestions?
Thanks
I know there's tons of examples of this online, but I've looked & can't for the life of me work out why my vlookup won't work. Here's my code:
Dim SC As Integer
Dim SN As String
SC = Range("S_Code").Value
SN = Application.WorksheetFunction.VLookup(SC, Range("S_Code_R"), 2, False)
SN is to be used to set the value of cell "S_Name".
I've tried it using Range("S_Code").Value, Range("S_Code"), "S_Code", S_Code in place of the SC but it keeps coming up with the error:
Method 'Range' of object '_Worksheet' failed
SC does have a value & is definitely included in the S_Code_R range
Any suggestions?
Thanks