Greetings,
I found this snippet of code in a Mr Excel post from 2018 that seems simple enough however I continue to receive the error below. Not sure what the issue is but would appreciate any assistance.
ERROR:
Run-time error '1004':
This extension cannot be used with the selected file type. Change the file extension in the File name text box or select a different file type by changing the Save as type.
It will generate one of the pages and then the error arises.
Thanks in advance!
I found this snippet of code in a Mr Excel post from 2018 that seems simple enough however I continue to receive the error below. Not sure what the issue is but would appreciate any assistance.
VBA Code:
Sub SaveSheetsAsFiles()
Dim SheetsToSave
SheetsToSave = Array("407 & HALTON", "DURHAM", "HAMILTON") 'change tab names to suit
Application.ScreenUpdating = False
For Each sht In Sheets(SheetsToSave)
sht.Copy
'file location is same as workbook the code is in. Change to suit
'file format is .xlsm - change to suit
ActiveWorkbook.SaveAs Filename:=sht.Name & ".xlsx", FileFormat:=52
Next sht
Application.ScreenUpdating = True
End Sub
ERROR:
Run-time error '1004':
This extension cannot be used with the selected file type. Change the file extension in the File name text box or select a different file type by changing the Save as type.
It will generate one of the pages and then the error arises.
Thanks in advance!