Hello, wondering if someone can help me.
I have put together the below code but not sure why it isn't working. I am trying to copy my formulas in range B8:F8, to all the way down to the last row - this last row number is calculated from the data in another sheet.
So e.g. in the School Payment Request sheet there are 81 rows from the start of the data "C12". So I would want the formula in the sheet to copy to range B89:F89 etc.
Just a bit stumped, any help appreciated thanks!
Sub CommandButton1_Click()
Dim mylastRow As Long
mylastRow = Worksheets("School Payment Request").Range("C12" & Rows.Count).End(xlDown).Row
Range("B8:F8").AutoFill Destination:=Range("B9:F" & mylastRow), Type:=xlFillDefault
MsgBox "Imported"
End Sub
I have put together the below code but not sure why it isn't working. I am trying to copy my formulas in range B8:F8, to all the way down to the last row - this last row number is calculated from the data in another sheet.
So e.g. in the School Payment Request sheet there are 81 rows from the start of the data "C12". So I would want the formula in the sheet to copy to range B89:F89 etc.
Just a bit stumped, any help appreciated thanks!
Sub CommandButton1_Click()
Dim mylastRow As Long
mylastRow = Worksheets("School Payment Request").Range("C12" & Rows.Count).End(xlDown).Row
Range("B8:F8").AutoFill Destination:=Range("B9:F" & mylastRow), Type:=xlFillDefault
MsgBox "Imported"
End Sub