I have 2 tables in different worksheets and i have to do vlookup to get the data from both these dynamic tables. I have done this using a for loop but sue to large data, excel is crashing. Is there any other way to do this?
The columns in the lookup array will be constant. But the rows will keep on changing.
Sheets("HRG").Activate
lastrow = ActiveSheet.UsedRange.Row + ActiveSheet.UsedRange.Rows.Count - 1
lastcolumn = ActiveSheet.UsedRange.Column +
ActiveSheet.UsedRange.Columns.Count - 1
Set VLRange = ActiveSheet.Range(Cells(2, 1), Cells(lastrow, lastcolumn))
Sheets("HRA").Activate
With ActiveSheet
lastrowHRA = .Range("A" & .Rows.Count).End(xlUp).Row
End With
For i = 2 To lastrowHRA
ActiveSheet.Cells(i, lastColHRA + 1) = Application.VLookup(ActiveSheet.Cells(i, 1), VLRange, 11, False)
ActiveSheet.Cells(i, lastColHRA + 2) = Application.VLookup(ActiveSheet.Cells(i, 1), VLRange, 53, False)
Next i