Hi all,
I have tried to get a vlookup formula to work, it works fine until i need to autofill it accross some columns, can anyone see where I am going wrong?
Code
Sub Macro5()
Dim R As Integer
ActiveCell.FormulaR1C1 = "=VLOOKUP(380860,C1:C,COLUMNS(C1:C),FALSE)"
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(380860,C1:C,COLUMNS(C1:C),FALSE)+VLOOKUP(378720,C1:C,COLUMNS(C1:C),FALSE)+VLOOKUP(390060,C1:C,COLUMNS(C1:C),FALSE)+VLOOKUP(390590,C1:C,COLUMNS(C1:C),FALSE)+VLOOKUP(393550,C1:C,COLUMNS(C1:C),FALSE)"
Range("B1", Range("B65536").End(xlUp)).Select
R = Selection.Rows.Count
Selection.AutoFill Destination:=Range("C" & R, "AG" & R), Type:=xlFillDefault
Range("C" & R).Select
End Sub
Display More
//Robert