I have a code that consolidates macro from multiple excel sheets to one sheet however I want to tweak that code so that it only consolidates tabs with a particular name in an excel sheet for eg suppose there are 3 tabs in all the excel sheets so I want only tab1 from those excel sheet to be consolidated into one excel sheet.
VBA Code:
Sub ConslidateWorkbooks()
'Created by Siddhant Singh
Dim FolderPath As String
Dim Filename As String
Dim Sheet As Worksheet
Application.ScreenUpdating = False
FolderPath = Environ("userprofile") & "\OneDrive - EY\Desktop\SOD Testing\"
Filename = Dir(FolderPath & "*.xls*")
Do While Filename <> ""
Workbooks.Open Filename:=FolderPath & Filename, ReadOnly:=True
For Each Sheet In ActiveWorkbook.Sheets
Sheet.Copy After:=ThisWorkbook.Sheets(1)
Next Sheet
Workbooks(Filename).Close
Filename = Dir()
Loop
Application.ScreenUpdating = True
End Sub