excel vba autoformat

Lambel
Lambel used Ask the Experts™
on
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

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Change

        Range("D3").Select

to

        Range("D2").Select
and


        Selection.AutoFill Destination:=Range("D2:D" & lastRw), Type:=xlFillDefault

to

        Selection.AutoFill Destination:=Range("D2:D" & lastRw), Type:=xlFillDefault
The previous comment refers to line 10

Author

Commented:
@ssaqibh: I tried that.  Now I get error: "Method 'Range' of object '_Global failed on the autofill.
Did you get both of my comments?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial