I am hoping someone can help me simplify this...
I have multiple tabs each I have a separate macro calling for each tab to be written to a directory in a shared network location.
I feel that this could be a lot cleaner...
Also I need it to not run copy the file over if J4 is blank on any of the tabs.
Any help would be appreciated.
I have multiple tabs each I have a separate macro calling for each tab to be written to a directory in a shared network location.
I feel that this could be a lot cleaner...
Also I need it to not run copy the file over if J4 is blank on any of the tabs.
Any help would be appreciated.
Code:
Sub Macro7()
Application.ScreenUpdating = False
Dim FolderPath As String, path As String, count As Integer
FolderPath = "\\busines path\TCC\Workgroup\Location Site\Public\Winshuttle Downtime\Reyes"
path = FolderPath & "\*.xlsx"
Filename = Dir(path)
Do While Filename <> ""
count = count + 1
Filename = Dir()
Loop
Application.DisplayAlerts = False
Sheets("CombinedOE").Select
Sheets("CombinedOE").Copy
ChDir _
FolderPath
ActiveWorkbook.SaveAs Filename:= _
FolderPath & "\" & Application.UserName & count & ".xlsx" _
, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
Application.DisplayAlerts = False
ActiveWorkbook.Close
Call Macro8
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Sub Macro8()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim FolderPath As String, path As String, count As Integer
FolderPath = "\\busines path\TCC\Workgroup\Location Site\Public\Winshuttle Downtime\CCBF"
path = FolderPath & "\*.xlsx"
Filename = Dir(path)
Do While Filename <> ""
count = count + 1
Filename = Dir()
Loop
Application.DisplayAlerts = False
Sheets("CombinedOEF").Select
Sheets("CombinedOEF").Copy
ChDir _
FolderPath
ActiveWorkbook.SaveAs Filename:= _
FolderPath & "\" & Application.UserName & count & ".xlsx" _
, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
Application.DisplayAlerts = False
ActiveWorkbook.Close
Call Macro9
Application.ScreenUpdating = False
Application.DisplayAlerts = False
End Sub
Sub Macro9()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim FolderPath As String, path As String, count As Integer
FolderPath = "\\busines path\TCC\Workgroup\Location Site\Public\Winshuttle Downtime\Heartland"
path = FolderPath & "\*.xlsx"
Filename = Dir(path)
Do While Filename <> ""
count = count + 1
Filename = Dir()
Loop
Application.DisplayAlerts = False
Sheets("CombinedOEH").Select
Sheets("CombinedOEH").Copy
ChDir _
FolderPath
ActiveWorkbook.SaveAs Filename:= _
FolderPath & "\" & Application.UserName & count & ".xlsx" _
, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
Application.DisplayAlerts = False
ActiveWorkbook.Close
Call Macro10
Application.ScreenUpdating = False
Application.DisplayAlerts = False
End Sub
Sub Macro10()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim FolderPath As String, path As String, count As Integer
FolderPath = "\\busines path\TCC\Workgroup\Location Site\Public\Winshuttle Downtime\Abarta"
path = FolderPath & "\*.xlsx"
Filename = Dir(path)
Do While Filename <> ""
count = count + 1
Filename = Dir()
Loop
Application.DisplayAlerts = False
Sheets("CombinedOEA").Select
Sheets("CombinedOEA").Copy
ChDir _
FolderPath
ActiveWorkbook.SaveAs Filename:= _
FolderPath & "\" & Application.UserName & count & ".xlsx" _
, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
Application.DisplayAlerts = False
ActiveWorkbook.Close
Call Macro11
Application.ScreenUpdating = False
Application.DisplayAlerts = False
End Sub
Sub Macro11()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim FolderPath As String, path As String, count As Integer
FolderPath = "\\busines path\TCC\Workgroup\Location Site\Public\Winshuttle Downtime\Liberty"
path = FolderPath & "\*.xlsx"
Filename = Dir(path)
Application.DisplayAlerts = False
Do While Filename <> ""
count = count + 1
Filename = Dir()
Loop
Application.DisplayAlerts = False
Sheets("CombinedOEL").Select
Sheets("CombinedOEL").Copy
ChDir _
FolderPath
ActiveWorkbook.SaveAs Filename:= _
FolderPath & "\" & Application.UserName & ".xlsx" _
, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
Application.DisplayAlerts = False
ActiveWorkbook.Close
Call Macro12
Application.ScreenUpdating = False
Application.DisplayAlerts = False
End Sub
Sub Macro12()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim FolderPath As String, path As String, count As Integer
FolderPath = "\\busines path\TCC\Workgroup\Location Site\Public\Winshuttle Downtime\Southwest"
path = FolderPath & "\*.xlsx"
Filename = Dir(path)
Do While Filename <> ""
count = count + 1
Filename = Dir()
Loop
Application.DisplayAlerts = False
Sheets("CombinedOESW").Select
Sheets("CombinedOESW").Copy
ChDir _
FolderPath
ActiveWorkbook.SaveAs Filename:= _
FolderPath & "\" & Application.UserName & count & ".xlsx" _
, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
Application.DisplayAlerts = False
ActiveWorkbook.Close
Call deleteinfo
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub