I'm new to VBA - I'm trying to write a Vlookup Function within Excel to refer to the lookup_value as a range of values. I have stored my values in a range called lookup_range, however I get N/A when I output the vlookup value to cells.
I have searched all over the internet, however I'm not seeing any solution to my questions.
Sub Vlookup_values()
Dim Vlkp_cell, n As Double
Dim Search_range, row_end, col_end As Double
Sheets("Movement").Activate
Range("A1").End(xlDown).Select
Vlkp_cell = ActiveCell.Row
ReDim Lookup_range(Vlkp_cell) As String
n = 0
Range("A1").Select
For n = 1 To Vlkp_cell
ActiveCell.Offset(1, 0).Select
Lookup_range(n) = ActiveCell.Value
ActiveCell.Offset(0, 9).Value = Lookup_range(n)
Next n
Sheets("Mapping").Activate
Range("A1").End(xlDown).Select
row_end = ActiveCell.Row
Range("A1").End(xlToRight).Select
col_end = ActiveCell.Column
Range(Cells(1, 1), Cells(row_end, col_end)).Name = "Search_range"
Range("Search_Range").Select
Sheets("Movement").Activate
Range("A1").Select
ActiveCell.Offset(0, 1).Select
n = 0
For n = 1 To Vlkp_cell
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = Application.VLookup(Lookup_range(n), Search_range, 2, False)
Next n
End Sub