Summary Report for SplitEachWorksheet() VBA Function

bftbeckett

New Member
Joined
Apr 20, 2022
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I am using the "Sub SplitEachWorksheet()" function in the VBA Module to get the file to split out into separate files for each sheet. However, I need a Summary report of the files created. Is this possible?

Preferably a summary as follows:
Worksheet name | File Name Created

Current Code:
VBA Code:
Sub SplitEachWorksheet()
Dim FPath, FileExtStr, DateString, xFile As String
Dim FileFormatNum As Long
FPath = Application.ActiveWorkbook.Path
Application.ScreenUpdating = False
Application.DisplayAlerts = False
 
For Each ws In ThisWorkbook.Sheets
    ws.Copy
    Application.ActiveWorkbook.SaveAs Filename:=FPath & "/" & ws.Name & ".csv"
    Application.ActiveWorkbook.Close False
Next
 
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
 
Last edited by a moderator:

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Adding more details.

My thought is that if I can save the worksheet names and filenames in an array and loop through it at the end to create a file with the worksheet name and the filename created.

I understand that the way this is written is having just the file name = the worksheet name. However, there is other criteria that is written that is not included due to proprietary info.
 
Upvote 0

Forum statistics

Threads
1,214,925
Messages
6,122,301
Members
449,078
Latest member
nonnakkong

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top