Hey all. Hope all is good.
First of all, thanks for your time in reading this request.
I am new to VBA and I don't know whether the below written code is properly used or not.
Below is the VBA code which I have written for applying Vlookup to certain columns. And Its working fine.
Sub Macro1()
'
' Macro1 Macro
'
'
ActiveCell.Offset(0, 1) = "=VLOOKUP(RC[-1],Database.xlsx!R1C1:R300C24,6,0)"
ActiveCell.Offset(0, 4) = "=VLOOKUP(RC[-4],Database.xlsx!R1C1:R300C24,12,0)"
..............continues for few more columns with row number / row cell being fixed.
End Sub
But to run this code properly, everytime I need to select the correct cell from where offset has to be done in each and every workbook as I have used "ActiveCell" option.
Can anyone tune the above code or suggest any other alternate method where I can apply this formula by fixing the cell .
Example:
Consider A5 has some code.
So, Lookup value will be "$A5" and Column_index_num will be varying everytime (i.e Column_index_num will be $A6, $A7, $A10 and so on).
Thank you all in advance for your suggestions.
Bookmarks