Can anyone help me with the following code i wrote:
It only saves the first sheet.
Edit: I figured it out - change activesheet.copy to ws.copy
It only saves the first sheet.
Code:
Sub copysheet()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ActiveSheet.Copy
wb_name = ActiveSheet.Name
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:= _
"C:\Users\Username\Desktop\" & wb_name & " Budget " & Format(Date, "dd-mm-yy") & ".xlsx", FileFormat:=51
ActiveWorkbook.Close
Application.DisplayAlerts = True
Next ws
End Sub
Edit: I figured it out - change activesheet.copy to ws.copy
Last edited: