Hi,

I have this loop (see code below) how can I get it to get the value and stop
the loop and move on to the rest of the code which is in the With Doc.

Thank you to anyone that helps,

Happy Holidays.

Ben Z.


With WordDoc

For Each oRow In oTbl.Rows
If oRow.Cells(1).Range.Text = TargetText Then
p = oRow.Cells(1).RowIndex & TextBox1.Text = p
End If
Next oRow

End With
End Sub

Re: Stop Loop and Get Value by David

David
Mon Dec 03 12:40:29 PST 2007


On Dec 3, 1:51 pm, Benz <B...@discussions.microsoft.com> wrote:
>
> With WordDoc
>
> For Each oRow In oTbl.Rows
> If oRow.Cells(1).Range.Text = TargetText Then

'Remove the last '=p' It's not needed.
> p = oRow.Cells(1).RowIndex & TextBox1.Text

Exit For

> End If
> Next oRow
>
> End With
> End Sub


Re: Stop Loop and Get Value by Benz

Benz
Tue Dec 04 13:01:02 PST 2007

Thanks David!

"David Sisson" wrote:

>
> On Dec 3, 1:51 pm, Benz <B...@discussions.microsoft.com> wrote:
> >
> > With WordDoc
> >
> > For Each oRow In oTbl.Rows
> > If oRow.Cells(1).Range.Text = TargetText Then
>
> 'Remove the last '=p' It's not needed.
> > p = oRow.Cells(1).RowIndex & TextBox1.Text
>
> Exit For
>
> > End If
> > Next oRow
> >
> > End With
> > End Sub
>
>