What I am trying to do here is write a code that will autofill down in Column A to the last row of data, according to Column B, using the last cell with data in Column A as the range for autofill. For instance Column A is "Name" and B is "Date". Column B has 6 dates, while Column A has a different "Name" every few rows down. Here is what I have so far:
Sub test()
Dim lastRow As Long
lastRow = Range("B" & Rows.Count).End(xlUp).Row
Range("A2").AutoFill Destination:=Range("A2:A" & lastRow)
End Sub
Here is my problem:
I would like to run the script and have it select the last filled cell in A (A4 for instance) and autofill down to the last row with data in column B.
My problem is it keeps selecting "A2" instead of the last cell in A ("A4" in this example) to autofill and fills all of column A with "A2", to the right distance none the less.
keeps selecting "A2" insteadbecause you told it to:Range("A2").AutoFill- findwindow