cutemeatball
New Member
- Joined
- Jun 13, 2022
- Messages
- 20
- Office Version
- 365
- Platform
- Windows
So I use this macro below to split my workbook into different workbooks depending on sheet names. However, only my last one SplitDAS does not work whenever I use SplitTechnologies Macro (the first one that runs the other 4 macros). I checked sheet names 100 times. And I found out that if I just run the SplitDAS macro (the last one) separately from SplitTechnologies Macro, it will work. Anyone know why? The error is a subscript out of range 9 window that highlights my first VBA code line in SplitDAS.
Any help or measures appreciated!
Thanks!
Any help or measures appreciated!
Thanks!
VBA Code:
Sub SplitTechnologies()
'change macro names to suit
Call SplitButch
Call SplitAV
Call SplitDAS
Call SplitSEC
End Sub
Sub SplitButch()
'
' SplitSheets Macro
'
'
Sheets(Array("Security", "AV", "Wireless", "SEC & AV", "Security RSS", "AV RSS", _
"SEC & AV RSS", "AV Divison", "Wireless Division")).Select
Sheets(Array("Security", "AV", "Wireless", "SEC & AV", "Security RSS", "AV RSS", _
"SEC & AV RSS", "AV Divison", "Wireless Division")).Copy
ActiveWorkbook.SaveAs Filename:= _
"C:\Users\e237915\Desktop\Security AV DAS ALL\SEC AV DAS.xlsx", FileFormat:= _
xlOpenXMLWorkbook, CreateBackup:=False
End Sub
Sub SplitAV()
'
' SplitSheets Macro
'
'
Sheets(Array("AV", "AV RSS", "AV Divison")).Select
Sheets(Array("AV", "AV RSS", "AV Divison")).Copy
ActiveWorkbook.SaveAs Filename:= _
"C:\Users\e237915\Desktop\Security AV DAS ALL\AV.xlsx", FileFormat:= _
xlOpenXMLWorkbook, CreateBackup:=False
End Sub
Sub SplitSEC()
'
' SplitSheets Macro
'
'
Sheets(Array("Security", "Security RSS")).Select
Sheets(Array("Security", "Security RSS")).Copy
ActiveWorkbook.SaveAs Filename:= _
"C:\Users\e237915\Desktop\Security AV DAS ALL\SEC.xlsx", FileFormat:= _
xlOpenXMLWorkbook, CreateBackup:=False
End Sub
Sub SplitDAS()
'
' SplitSheets Macro
'
'
Sheets(Array("Wireless", "Burkhart", "Barnhill", "Allen", "Finger", "McCallum", "Wireless Division")).Select
Sheets(Array("Wireless", "Burkhart", "Barnhill", "Allen", "Finger", "McCallum", "Wireless Division")).Copy
ActiveWorkbook.SaveAs Filename:="C:\Users\e237915\Desktop\Security AV DAS ALL\DAS.xlsx", FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
End Sub