Mar 16 2022 06:48 AM
Hi there, I am extremely new to using excel and I have run into a problem that I need help with.
I have a spreadsheet open that lists equipment at stations. This is all listed in one file under separate
"tabs" (at the bottom of the screen) . I need them to be separate files. Does anyone know of an easy way
to break this large file into separate files referenced by the "tabs" that I mentioned earlier?
Thanks very much!
Mar 16 2022 08:08 AM
Here is a macro you can run:
Sub SplitWorkbook()
Dim strPath As String
Dim wsh As Worksheet
Application.ScreenUpdating = False
Application.DisplayAlerts = False
strPath = ActiveWorkbook.Path
If Right(strPath, 1) <> Application.PathSeparator Then
strPath = strPath & Application.PathSeparator
End If
For Each wsh In ActiveWorkbook.Worksheets
wsh.Copy
ActiveWorkbook.SaveAs Filename:=strPath & wsh.Name & ".xlsx", FileFormat:=xlOpenXMLWorkbook
ActiveWorkbook.Close SaveChanges:=False
Next wsh
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub