Good day,
The following code needs to Copy data from all Worksheets, except 2 specified, and paste underneath each other in the "Summary" tab, then delete the worksheets that the data was copied from.
It works except it still copies the 2 specified not to and delete them as well. Please help.
![]()
'Add all tabs to Summary and Delete sheets and hidden sheets Dim lRow As Long Dim ws As Worksheet Dim pasteSheet As Worksheet Set pasteSheet = Worksheets("Summary") Application.DisplayAlerts = False For Each ws In Worksheets If ws.Visible = xlSheetHidden Then ws.Delete End If Next ws Application.DisplayAlerts = True For Each ws In Sheets lRow = pasteSheet.Cells(Rows.Count, "A").End(xlUp).Row + 1 If ws.Name <> pasteSheet.Name AND ws.Name <> "KAM" AND ws.Name <> "OPS" Then ws.Range("A15:AD" & Range("A" & Rows.Count).End(xlUp).Row).Copy pasteSheet.Range("A" & lRow).PasteSpecial Application.DisplayAlerts = False ws.Delete Application.DisplayAlerts = True End If Next ws
Bookmarks