Exclude worksheet from loop.

Joined
Jun 6, 2011
Messages
1
Reaction score
0
I have a worksheet using the code below that consolidates all sheet data into the "Recap" sheet. This code works fime but I would like to add a sheet("Code List") to the workbook and exclude it from this code.I'd appreciate any help with this.Thanks!

Code:
Sub ConsolidateDataMacro_for_cure4glass1()'Macro author: tigeravatar Application.ScreenUpdating = False Dim wsDest As Worksheet: Set wsDest = Sheets("Recap") Dim NewLine As Long: NewLine = 4 wsDest.UsedRange.Offset(NewLine, 0).ClearContents Dim SheetIndex As Long, RowIndex As Long Dim ws As Worksheet, rngData As Range For SheetIndex = 1 To Sheets.Count Set ws = Sheets(SheetIndex) If ws.Name <> wsDest.Name Then For RowIndex = 4 To 25 If ws.Cells(RowIndex, "B").Value <> vbNullString Then Set rngData = ws.Range(ws.Cells(RowIndex, "A"), ws.Cells(RowIndex, Columns.Count).End(xlToLeft)) wsDest.Cells(NewLine, "A").Resize(1, rngData.Columns.Count).Value = rngData.Value NewLine = NewLine + 1 End If Next NewLine = NewLine + 1 End If Next Application.ScreenUpdating = True End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top