Code:
On Error Resume Next
Application.ScreenUpdating = False
Application.DisplayAlerts = False
start_dates
'make folders for RAW
p1 = ThisWorkbook.Path & "\Raw Data\"
If Len(Dir(p1 & fiscal_year, vbDirectory)) = 0 Then
MkDir (p1 & fiscal_year)
End If
p2 = p1 & fiscal_year
'
Range("save_raw") = "DONE!"
'To copy Raw Data to rawdata - MMMM
'if report date is the same as the first business day of the month then make a new monthly file
If Range("reportdate") = Range("fom") Then
Sheets("RawData").Copy
ActiveWorkbook.SaveAs Filename:= _
p2 & "\RawData - " & show_Month_long & " " & show_Year & ".xlsb" _
, FileFormat:=50
ActiveSheet.Name = format(Range("ReportDate"), "mmm DD")
ActiveWindow.ScrollRow = 1
ActiveWindow.ScrollColumn = 1
Else
Set raw = Workbooks.Open(p2 & "\RawData - " & show_Month_long & " " & show_Year & ".xlsb")
ThisWorkbook.Sheets("RawData").Copy Before:=Workbooks("RawData - " & show_Month_long & " " & show_Year & ".xlsb").Sheets(1)
ActiveSheet.Name = format(Range("ReportDate"), "mmm DD")
ActiveWindow.ScrollRow = 1
ActiveWindow.ScrollColumn = 1
End If
Application.DisplayAlerts = True
ActiveWorkbook.Close True
MsgBox "Done!"
ThisWorkbook.Save
Application.ScreenUpdating = True
i click this macro button in a worksheet called "Menu"...i noticed when it crashes and i re-open the file, the "menu" worksheet has been renamed to the reportdate
so im guessing it's crashing here....
Code:
Set raw = Workbooks.Open(p2 & "\RawData - " & show_Month_long & " " & show_Year & ".xlsb")
ThisWorkbook.Sheets("RawData").Copy Before:=Workbooks("RawData - " & show_Month_long & " " & show_Year & ".xlsb").Sheets(1)
ActiveSheet.Name = format(Range("ReportDate"), "mmm DD")
weird thing is it was working fine for months...**** excel
Last edited by a moderator: