title: Loop to go through each worksheet in workbook
body: <p>I'm trying to loop through each worksheet in the workbook but it's not working.  I think it's the ActiveWorkbook.Worksheets not recognizing each worksheet and only running on the Active worksheet.  Any suggestions would be great! I'm sure this is a basic fix but can't seem to figure it out.  Thanks!</p>
  
  <pre><code>Sub LoopThroughWorksheets()
      Dim ws As Worksheet
  
      For Each ws In ActiveWorkbook.Worksheets
          If (ws.Name &lt;&gt; "Sheet1") And (ws.Name &lt;&gt; "Sheet2") And (ws.Name &lt;&gt; "Sheet8") And (ws.Name &lt;&gt; "Sheet42") Then
  
              With ws
                  'code
                  'Sheets("Formula").Select
                  Range("FormulaRow").Copy
                  'Selection.Copy
                  ActiveSheet.Select
                  ActiveSheet.Range("A1").Select
                  ActiveSheet.Paste
                  Calculate
                  Range("Q1:X1").Select
                  Selection.Copy
                  Range("Q3:X3000").Select
                  Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
                      SkipBlanks:=False, Transpose:=False
                  Application.CutCopyMode = False
                  Calculate
                  Selection.Copy
                  Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
                      :=False, Transpose:=False
  
              End With
          End If
      Next ws
  
  End Sub
  </code></pre>