title: How to apply VBA code to all worksheets in the workbook
body: <p>This code should delete rows that contain specific text and apply it to all the sheets in the workbook.</p>
  
  <p>When I try this code, it applies to only one worksheet.</p>
  
  <pre><code>Sub WorksheetLoop()
  
       Dim c As Integer
       Dim n As Integer
       c = ActiveWorkbook.Worksheets.Count
       For n = 1 To c Step 1
          Last = Cells(Rows.Count, "A").End(xlUp).Row
          For I = Last To 1 Step -1
              If (Cells(I, "A").Value) = "Text" Then
                  Cells(I, "A").EntireRow.Delete
              End If
          Next I
       Next n
  
   End Sub
  </code></pre>