Avatar of Lambel
Lambel

asked on 

excel vba autoformat

I want find the row that contains the last record, and then copy a formula that is in the first row, column D, down the whole column.  My autofill statement isn't working.  Whats wrong with it?
' the fomula to pull the pool counts
        Range("A2").Select
        lastRw = Range("A" & Rows.Count).End(xlUp).Row + 1
        Range("D2").Select
        ActiveCell.FormulaR1C1 = _
        "=IF(ISNA(VLOOKUP(RC[-3],'OH Count Pool'!R2C[-3]:R1000C[-1],3,FALSE)),"""",VLOOKUP(RC[-3],'OH Count Pool'!R2C[-3]:R1000C[-1],3,FALSE))"
        Range("D3").Select
        ' find last record
 
        Selection.AutoFill Destination:=Range(lastRw, "D"), Type:=xlFillDefault

Open in new window

Microsoft Excel

Avatar of undefined
Last Comment
Saqib Husain

8/22/2022 - Mon