excel vba run time error 1004 application defined or object defined error after code has run on 8 sheets
<p>this code works for the first 8 sheets, anything thereafter comes up with the thread title? any ideas please.  [The code is in each sheet module and unique i.e. "Sheet05.PA05" will read "Sheet06.PA06" and the Sub name will change from PA05 to PA06 and so on till sheet 25].</p>

<p>`</p>

<pre><code>Private Sub CommandButton2_Click()
Application.Run "Sheet05.PA05"
End Sub

Sub PA05()

Dim fnd As String, FirstFound As String, counter  As Integer
Dim FoundCell As Range, rng As Range
Dim myRange As Range, LastCell As Range, moduleRange As Range

counter = 3

'What value do you want to find (must be in string form)?
  fnd = Range("A1")

Set myRange = Worksheets("EBS Modules &amp; Data").Range("C3:O24")
Set LastCell = myRange.Cells(myRange.Cells.Count)
Set FoundCell = myRange.Find(What:=fnd, LookAt:=xlWhole, After:=LastCell)

'Test to see if anything was found
  If Not FoundCell Is Nothing Then
    FirstFound = FoundCell.Address
  Else
    GoTo NothingFound
  End If

Set rng = FoundCell

'Loop until cycled through all unique finds
  Do Until FoundCell Is Nothing

     With Worksheets("EBS Modules &amp; Data")

        Set moduleRange = .Cells(FoundCell.Row, 1)
        moduleRange.Copy Sheet05.Range(Cells(counter, 1), Cells(counter, 1))
        counter = counter + 1

     End With

    'Find next cell with fnd value
      Set FoundCell = myRange.FindNext(After:=FoundCell)

    'Add found cell to rng range variable
      Set rng = Union(rng, FoundCell)

    'Test to see if cycled through to first found cell
      If FoundCell.Address = FirstFound Then Exit Do


  Loop


Exit Sub

'Error Handler
NothingFound:
  MsgBox "No values were found in this worksheet"

End Sub
</code></pre>

<p>`</p>