Hi, The below macro originally worked fine, but now, for some reason, the new copied worksheet is not saving any of the cell properties.
The macro ran through a list of names and then repopulated the pivot table on the worksheet for that person, thus creating a small invoice with the list of items and total in a smaller version of the table; but now the properties (cell border and formatting) disappear from the newly created sheets. The code is:
Please could any offer any assistance.
Many Thanks
Thanks in advance.
The macro ran through a list of names and then repopulated the pivot table on the worksheet for that person, thus creating a small invoice with the list of items and total in a smaller version of the table; but now the properties (cell border and formatting) disappear from the newly created sheets. The code is:
VBA Code:
Sub Save_Sheets_To_New_Books() 'INVOICES
Const strWbPath As String = "D:\Accounts\EA Letters\2020 09 September\"
Dim strDate As String 'todays date
'save the sheets to new books within the active folder and print them
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
strDate = Format(Date, "yyyy.mm.dd") '(Date, "yyyy.mm.dd") THIS IS WHERE THE ERROR OCCURS the word DATE is highlighted
ActiveSheet.Copy
Call DeleteNamedRanges
Call PrintAreaAndPasteSpecial
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=strWbPath & Name_of_Artist & "_" & strDate & ".pdf" _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
ActiveWorkbook.SaveAs FileName:=strWbPath & Name_of_Artist & "_" & strDate & ".xlsx"
Application.DisplayAlerts = True
'ActiveSheet.PrintOut Copies:=1, Collate:=True 'remove the comment if you want to print it out as well
ActiveWorkbook.Close False
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
Please could any offer any assistance.
Many Thanks
Thanks in advance.
Last edited by a moderator: