Hi,
I have this vba to combine sheets. When I run it I have no errors.
Sub CombineWorkbooks()
Dim Path As String
Path = "N:\Bridge_delivery_file\"
Dim FileName As String
FileName = Dir(Path & "*.xl??")
Dim ws As Worksheet
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Do While FileName <> ""
Workbooks.Open Path & FileName
For Each ws In ActiveWorkbook.Sheets
ws.Copy after:=ThisWorkbook.Worksheets(ThisWorkbook.Worksheets.Count)
Next ws
Workbooks(FileName).Close
FileName = Dir()
Loop
Worksheets(1).Delete
Application.ScreenUpdating = False
Application.DisplayAlerts = False
End Sub
But when I have finished to run it, looks like my excel crashed or something. It looks like that: all grey
But in the developper, I see some sheets being added (not all and some are duplicates). But I cannot see them inthe excel.
Strange no ?
I have this vba to combine sheets. When I run it I have no errors.
Sub CombineWorkbooks()
Dim Path As String
Path = "N:\Bridge_delivery_file\"
Dim FileName As String
FileName = Dir(Path & "*.xl??")
Dim ws As Worksheet
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Do While FileName <> ""
Workbooks.Open Path & FileName
For Each ws In ActiveWorkbook.Sheets
ws.Copy after:=ThisWorkbook.Worksheets(ThisWorkbook.Worksheets.Count)
Next ws
Workbooks(FileName).Close
FileName = Dir()
Loop
Worksheets(1).Delete
Application.ScreenUpdating = False
Application.DisplayAlerts = False
End Sub
But when I have finished to run it, looks like my excel crashed or something. It looks like that: all grey
But in the developper, I see some sheets being added (not all and some are duplicates). But I cannot see them inthe excel.
Strange no ?