Hi All,
I have a table in excel where I am trying to write a script that inputs a column name into a cell, enters the formula for that column below, then drags the formula down to the last row of the tableau. This is the script I am using but, once it gets down to row 5, it starts to use the previous row for the lookup value. Do anyone know why this my be hapenning?
Range("N3").Select
ActiveCell.FormulaR1C1 = "Merchandise Category"
Range("N4").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-3],MARA!C[-13]:C[-12],2,0)"
lastRow = Cells(Rows.Count, "M").End(xlUp).Row
Range("N5:N" & lastRow).SpecialCells(xlCellTypeBlanks).Formula = Range("N4").Formula
Thanks in advance!
I have a table in excel where I am trying to write a script that inputs a column name into a cell, enters the formula for that column below, then drags the formula down to the last row of the tableau. This is the script I am using but, once it gets down to row 5, it starts to use the previous row for the lookup value. Do anyone know why this my be hapenning?
Range("N3").Select
ActiveCell.FormulaR1C1 = "Merchandise Category"
Range("N4").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-3],MARA!C[-13]:C[-12],2,0)"
lastRow = Cells(Rows.Count, "M").End(xlUp).Row
Range("N5:N" & lastRow).SpecialCells(xlCellTypeBlanks).Formula = Range("N4").Formula
Thanks in advance!