I'd like to select the last row from B to Z only (that's the only row that has formulas in it.) This range should autofill only one row down and make the second last row values only (meaning remove formulas). So the last row should always have formulas in it.
a dataset that looks like this:
A B C ..... Z
1 1 2 2 ......26
2 1 2 2 ......26
3 1 2 2 ......26
4 1 2 2 ......26
5 1 2 2 ......26
So the code should select from B5:Z5 and autofill down one row.
I have tried the following code and it gives me a runtime error.
Sub autofilllastrow()
Dim Lastrow As Integer
Dim Lastrange As Range
Lastrow = ActiveWorkbook.Worksheets("sheet1").Cells(Rows.Count, 2).End(xlUp).Row
Range("B" & Lastrow, "Z" & Lastrow).Select
Lastrange.AutoFill Destination:=Range("B" & Lastrow + 1, "Z" & Lastrow + 1)
End Sub
How should I properly define the Destination part and make the second last row values only?
Lastrange, so it staysNothing, this will give you a runtime error - FunThomas