How do I resolve vba error 1004 when trying to autofill using a variable for dynamic range?

Alley, Ann 0 Reputation points

I get error 1004 on this line of Excel vba code and don't know how to resolve.

Selection.AutoFill Destination:=Range("R2:R" & lastRow)

Dim wb As Workbook

Dim ws As Worksheet

Set wb = ActiveWorkbook

Set ws = Sheets("Milestones")



Dim lastRow As Long

lastRow = ws.Range("A" & ws.Rows.Count).End(xlUp).Row
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
1,619 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,658 questions
{count} votes