Hi Guys, been struggling to find a solution to this for a couple of days. Fairly new to VBA. I'm trying the write a macro that takes the last line with data in a spreadsheet and fills it down to the line below (copying formulas etc).
With a cell on the last row selected (will work on getting it to automatically select the last row later), I can use this:
ActiveCell.EntireRow.Select
Selection.AutoFill Destination:=Rows("297:298"), Type:=xlFillDefault
but only if the last row is 297. So I want to replace 297 and 298 with the last row and the next row on any given sheet.
I can find the last row and next row
LastRow = Worksheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
NextRow = LastRow + 1
so I want to insert the result of those variables into the statement above, like:
ActiveCell.EntireRow.Select
Selection.AutoFill Destination:=Rows("LastRow:NextRow"), Type:=xlFillDefault
But can't figure out how to do this. Can anyone help?
Cheers
Bookmarks