I have this macros below that keeps giving me a Run Time Error 91, Object Variable or With Block Variable not set prompt at the line that begins "Loop While". I was wondering if this can be fixed. This was a problem that arose from an existing thread, as its a new issue I am reposting. Thank You.


Dim c As Range, firstaddress As String, a As Long
Dim pSheet As Excel.Worksheet

For Each pSheet In ActiveWorkbook.Sheets
pSheet.Activate

With Columns(1)
  Set c = .Find("Investor", LookIn:=xlValues, LookAt:=xlWhole)
  If Not c Is Nothing Then
    firstaddress = c.Address
    Do
      a = a + 1
      If a > 1 Then c = "Holder"
      c.Offset(, 3) = "% of CSO"
      Range("C" & c.Row & ":C" & c.Row + 20).Value = Range("D" & c.Row & ":D" & c.Row + 20).Value
      Set c = .FindNext(c)
    Loop While Not c Is Nothing And c.Address <> firstaddress
   Range(firstaddress) = "Holder"
  Else
   
  End If

End With
Next pSheet