none
Prevent macro from running on a specific worksheet RRS feed

  • Question

  • I have a workbook with multiple worksheets and I want to prevent the macro from running on a specific sheet. The code is listed below. How can I make this work?

    Sub
    Dim ws  As Worksheet, _
        LR1 As Long, _
        LR2 As Long
    Application.ScreenUpdating = False
    For Each ws In ActiveWorkbook.Worksheets
        If ws.Name <> "Master" Then
            LR1 = Sheets("Master").Range("A" & Rows.Count).End(xlUp).Row + 1
            LR2 = ws.Range("d" & Rows.Count).End(xlUp).Row
            ws.Range("A1:d" & LR2).Copy Destination:=Sheets("Master").Range("A" & LR1)
        End If
    Next ws
    Application.ScreenUpdating = True
    End Sub

    Tuesday, August 11, 2015 2:29 PM

Answers

  • Change

    If ws.Name <> "Master" Then

    If ws.Name <> "Master" And ws.Name <> "Other Sheet to Ignore" Then

    • Proposed as answer by André Santo Tuesday, August 11, 2015 2:44 PM
    • Marked as answer by rivrgrl7 Tuesday, August 11, 2015 3:03 PM
    Tuesday, August 11, 2015 2:35 PM

All replies