PC Review


Reply
Thread Tools Rate Thread

How do you stop the Find method?

 
 
=?Utf-8?B?UmljaCBXLg==?=
Guest
Posts: n/a
 
      13th Jun 2007
I'm new to Excel programming . . . The following procedure finds a string in
a column, then goes a couple columns over (determined via user input) and
enters a category.

The procedure finds the appropriate entry and enters the text in a column,
on the same row, as it should.

However, it continues to loop through the spreadsheet, until I do a
Ctrl+Break.

How do I determine when the Find method has gone through the worksheet once.

Thanks in advance,

Rich

This is the loop:
Do
Cells.Find(What:=txtSrchString, After:=ActiveCell,
LookIn:=xlFormulas, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=True, _
SearchFormat:=False).Activate
CellAddress = txtOutputCol & ActiveCell.Row
Range(CellAddress).Select
ActiveCell.Value = txtReplString
Loop Until Cells.Find(What:=txtSrchString, After:=ActiveCell,
LookIn:=xlFormulas, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=True, _
SearchFormat:=False) <> txtSrchString.Text

 
Reply With Quote
 
 
 
 
Ron de Bruin
Guest
Posts: n/a
 
      13th Jun 2007
Hi Rich

See how I do it in this example

http://www.rondebruin.nl/find.htm#Mark

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Rich W." <(E-Mail Removed)> wrote in message news:09FF69C1-3D69-408F-B2B8-(E-Mail Removed)...
> I'm new to Excel programming . . . The following procedure finds a string in
> a column, then goes a couple columns over (determined via user input) and
> enters a category.
>
> The procedure finds the appropriate entry and enters the text in a column,
> on the same row, as it should.
>
> However, it continues to loop through the spreadsheet, until I do a
> Ctrl+Break.
>
> How do I determine when the Find method has gone through the worksheet once.
>
> Thanks in advance,
>
> Rich
>
> This is the loop:
> Do
> Cells.Find(What:=txtSrchString, After:=ActiveCell,
> LookIn:=xlFormulas, LookAt:= _
> xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
> MatchCase:=True, _
> SearchFormat:=False).Activate
> CellAddress = txtOutputCol & ActiveCell.Row
> Range(CellAddress).Select
> ActiveCell.Value = txtReplString
> Loop Until Cells.Find(What:=txtSrchString, After:=ActiveCell,
> LookIn:=xlFormulas, LookAt:= _
> xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
> MatchCase:=True, _
> SearchFormat:=False) <> txtSrchString.Text
>

 
Reply With Quote
 
=?Utf-8?B?UmljaCBXLg==?=
Guest
Posts: n/a
 
      13th Jun 2007
Thanks Ron . . .

I read Daily Dose of Excel; I see your name from time to time, and will have
to use your site as a resource . . .

Thanks again,

Rich

"Ron de Bruin" wrote:

> Hi Rich
>
> See how I do it in this example
>
> http://www.rondebruin.nl/find.htm#Mark
>
> --
>
> Regards Ron de Bruin
> http://www.rondebruin.nl/tips.htm
>
>
> "Rich W." <(E-Mail Removed)> wrote in message news:09FF69C1-3D69-408F-B2B8-(E-Mail Removed)...
> > I'm new to Excel programming . . . The following procedure finds a string in
> > a column, then goes a couple columns over (determined via user input) and
> > enters a category.
> >
> > The procedure finds the appropriate entry and enters the text in a column,
> > on the same row, as it should.
> >
> > However, it continues to loop through the spreadsheet, until I do a
> > Ctrl+Break.
> >
> > How do I determine when the Find method has gone through the worksheet once.
> >
> > Thanks in advance,
> >
> > Rich
> >
> > This is the loop:
> > Do
> > Cells.Find(What:=txtSrchString, After:=ActiveCell,
> > LookIn:=xlFormulas, LookAt:= _
> > xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
> > MatchCase:=True, _
> > SearchFormat:=False).Activate
> > CellAddress = txtOutputCol & ActiveCell.Row
> > Range(CellAddress).Select
> > ActiveCell.Value = txtReplString
> > Loop Until Cells.Find(What:=txtSrchString, After:=ActiveCell,
> > LookIn:=xlFormulas, LookAt:= _
> > xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
> > MatchCase:=True, _
> > SearchFormat:=False) <> txtSrchString.Text
> >

>

 
Reply With Quote
 
choua_yang22@yahoo.com
Guest
Posts: n/a
 
      13th Jun 2007
Hey Rich,

I would do a do until or do while loop. I like these more because it
sets parameters and tells the loop to stop at a certain point. For
me, it's usually when it gets to blank or "".

Hope that helped.

Kevin

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Overriding the Timer.Stop() Method Michael_R_Banks Microsoft VB .NET 2 17th Feb 2010 04:47 PM
xls vba find method to find row that contains the current date =?Utf-8?B?UkNyYW5zdG9u?= Microsoft Excel Programming 5 28th Mar 2007 03:59 PM
date find using find method x taol Microsoft Excel Programming 2 22nd Dec 2005 09:51 AM
Using variables to make a date and using find method to find that. =?Utf-8?B?S3lXaWxkZQ==?= Microsoft Excel Programming 2 21st Apr 2005 09:43 PM
Outoook 2002 FIND function doesn't stop when click stop, loop? igooba Microsoft Outlook Discussion 0 26th Nov 2003 11:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:03 PM.