Note that there are some explanatory texts on larger screens.

plurals
  1. POVBA .findnext not working. Runtime error 91 object variable or with block variable not set
    primarykey
    data
    text
    <p>I am trying to execute a search where it searches through a column for "REQM" (no quotes) and set the range of the found cell to d. Then call another sub function that finds where to enter the data into. My FindEntryArea sub function works fine and my first find works great but when it tries to findnext it is not working properly.</p> <pre><code>Sub FindLoop() Dim re as Range Set re = Sheets(1).Range("T:T") With re Set d = .Find("REQM", LookIn:=xlFormulas, LookAt:=xlWhole) MsgBox (d.Row) Call FindEntryArea Do Set d = .FindNext(d) MsgBox (d.Row) Call FindEntryArea Loop While Not d Is Nothing End With End Sub </code></pre> <p>Trying to figure out the error I used msgbox to print out the row of the range that was being found this worked fine for the first cell but did not work for the findnext. I get object variable or with block variable not set. I am fairly new to VBA and this is my first time using findnext so any guidance would be appreciated. Also re is my range and there are plenty of other cells that should be found within it.</p> <p>Thanks.</p> <p>EDIT:</p> <p>Main code and findloop</p> <pre><code>Public re As Range Public d As variant Sub MainCode() Dim r as Range Set re = Worksheets("Summary all PIIDB").Range("T:T") Set r = Worksheets("Summary all PIIDB") With r Call FindLoop End With End Sub Sub FindLoop() With re Set d = .Find("REQM", LookIn:=xlFormulas, LookAt:=xlWhole) MsgBox (d.Row) 'Call FindEntryArea Set d = .FindNext(d) MsgBox (d.Row) 'Call FindEntryArea End With End Sub </code></pre> <p>I removed the loop just to get findnext working first and yet I am still struggling.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload