Hi, I am using the code below to export data using a command button click which works fine, is there a way to change this so it will auto save on the first of every month then clear all the data in all sheets starting from A2, the work book is always open and never closed unless the pc needs to restart after updates.
Regards
VBA Code:
Private Sub CommandButton6_Click()
Unload Admin
Dim Filepath As String
Dim FileName As String
Dim MyDate As String
Dim Report As String
Sheets("EXIT").Visible = False
Sheets("Info").Visible = False
Sheets("Search").Visible = False
Filepath = "P:\Kenny\Stores\Exported_Data\"
MyDate = Format(Now(), "dd_mm_yyyy_hhmm")
Report = " Report"
FileName = Filepath & MyDate & Report
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, FileName:=FileName
MsgBox "All Data Has Been Successfully Exported."
End Sub
Regards