there you go, hope it works the way you want, let me know if it doesn't
the code will create a sheet named master, you should start only with the sheets that you want consolidated since it will loop through all sheets, if you have sheets that you don't want consolidated then you will have to change the "for s =" line
Sub Loop_Example()
Dim Firstrow As Long
Dim Lastrow As Long
Dim Lrow As Long
For s = 1 To Sheets.Count
Sheets(s).Select
'Sheets("MySheet")if you want
With ActiveSheet
'Set the first and last row to loop through
If Sheets(s).Name = Sheets(1).Name Then
Firstrow = 1
Else:
Firstrow = 2
End If
Lastrow = .UsedRange.Rows(.UsedRange.Rows.Count).Row
Rows(Firstrow & ":" & Lastrow).Copy
Const strSheetName As String = "Master"
Set wsTest = Nothing
On Error Resume Next
Set wsTest = ActiveWorkbook.Worksheets(strSheetName)
On Error GoTo 0
If wsTest Is Nothing Then
Worksheets.Add after:=Sheets(Sheets.Count)
ActiveSheet.Name = strSheetName
End If
Sheets("Master").Activate
If Firstrow = 1 Then
Lastrowa = ActiveSheet.Cells(.Rows.Count, "A").End(xlUp).Row
Else:
Lastrowa = ActiveSheet.Cells(.Rows.Count, "A").End(xlUp).Row + 1
End If
Range("A" & Lastrowa).Activate
ActiveSheet.Paste
Range("A1").Select
End With
Application.CutCopyMode = False
Next
End Sub
Bookmarks