I am currently using the following procedure to take a spreadsheet with multiple worksheets to create and save each worksheet into separate files based on the worksheet names.
This works as expect but now I also need to add one unique worksheet to each workbook that is created through the process above, we'll call it "procedures", so that each saved worksheet has a second worksheet called procedures. I am stumped how to alter this process to add in that worksheet to each file. Alternatively, I am ok with a process to take this worksheet and add it to ALL files in a given folder. I have tried the process below with no luck as I get a vba/macro enabled save error on EACH file that opens to select yes or no, this is not something I wish to do as there are 100+ files, it needs to be automated. THANKS
VBA Code:
Sub Splitbook()
'Updateby20140612
Dim xPath As String
xPath = Application.ActiveWorkbook.Path
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each xWs In ThisWorkbook.Sheets
xWs.Copy
ActiveSheet.Protect
Application.ActiveWorkbook.SaveAs Filename:=xPath & "\" & xWs.Name & ".xlsx"
Application.ActiveWorkbook.Close False
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
This works as expect but now I also need to add one unique worksheet to each workbook that is created through the process above, we'll call it "procedures", so that each saved worksheet has a second worksheet called procedures. I am stumped how to alter this process to add in that worksheet to each file. Alternatively, I am ok with a process to take this worksheet and add it to ALL files in a given folder. I have tried the process below with no luck as I get a vba/macro enabled save error on EACH file that opens to select yes or no, this is not something I wish to do as there are 100+ files, it needs to be automated. THANKS
Copy Worksheet from master file to multiple files in a folder with VBA
Hi, hoping someone can help me with this. I have a workbook called Rules which contains one worksheet also called Rules. I would like to take a mirror of this worksheet in its entirety and move a copy to all the excel files in a destination folder that I specify. I am using a third file as a...
www.mrexcel.com