Hello,
I have the following code:
where I want to modify it and:
1) Rename the new 'master' file as "Consolidation" and save it into the same location as the Path.
2) Perform the consolidation from all the new created tabs into one with name "Summary"
(The code opens the targeted spreadsheets, creates a new file with name: Sheet1, Sheet2 or in this format and then it creates the Tab Summary) It doesnt do the consolidation of the internal tabs and cannot find a way for the renaming and save into the same folder as my path.
Thank you in advance for any help.
I have the following code:
HTML:
Sub Merge2MultiSheets()
Dim wbDst As Workbook
Dim wbSrc As Workbook
Dim wsSrc As Worksheet
Dim MyPath As String
Dim strFilename As String
Dim LastRow As Long
Dim wsht As Worksheet
Dim i As Integer
Application.DisplayAlerts = False
Application.EnableEvents = False
Application.ScreenUpdating = False
MyPath = "\\....." ' change to suit
Set wbDst = Workbooks.Add(xlWBATWorksheet)
strFilename = Dir(MyPath & "\*.xls", vbNormal)
If Len(strFilename) = 0 Then Exit Sub
Do Until strFilename = ""
Set wbSrc = Workbooks.Open(Filename:=MyPath & "\" & strFilename)
Set wsSrc = wbSrc.Worksheets(1)
wsSrc.Copy After:=wbDst.Worksheets(wbDst.Worksheets.Count)
wbSrc.Close False
strFilename = Dir()
Loop
wbDst.Worksheets(1).Delete
Sheets.Add
ActiveSheet.Name = "Summary"
For Each wbDst In ThisWorkbook.Worksheets
If wbDst.Name <> "Summary" Then
wbDst.UsedRange.Offset(4, 0).Copy Destination:=Sheets("Summary").Range("A94526").End(xlUp).Offset(1, 0)
End If
Next wbDst
Application.DisplayAlerts = True
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
where I want to modify it and:
1) Rename the new 'master' file as "Consolidation" and save it into the same location as the Path.
2) Perform the consolidation from all the new created tabs into one with name "Summary"
(The code opens the targeted spreadsheets, creates a new file with name: Sheet1, Sheet2 or in this format and then it creates the Tab Summary) It doesnt do the consolidation of the internal tabs and cannot find a way for the renaming and save into the same folder as my path.
Thank you in advance for any help.