I've been messing around with some code to create new workbooks, with variable names depending on some values in cells. I wanted to have the macro run in a button, but don't want the button to be there on the newly created workbooks.
How would I have it delete like 3 rows on the new workbook (22-24 to be specific) in this code?
How would I have it delete like 3 rows on the new workbook (22-24 to be specific) in this code?
Code:
Sub Forecast()
Dim Group As String
Dim Month As String
Dim wbNew As Workbook
Group = Range("A3").Value
Month = Range("A4").Value
Application.DisplayAlerts = False
Sheets("Allocations").Copy
Set wbNew = ActiveWorkbook
With Sheets("Allocations").UsedRange
.Value = .Value
End With
wbNew.SaveAs "C:\...Forecast\Forecast_" & Group & " " & Format(Month, "mmmm-yy") & ".xlsx"
wbNew.Close True
Application.DisplayAlerts = True
End Sub