Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default How do you stop the Find method?

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default How do you stop the Find method?

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." wrote in message ...
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default How do you stop the Find method?

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." wrote in message ...
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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How do you stop the Find method?

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
xls vba find method to find row that contains the current date RCranston Excel Programming 3 March 28th 07 03:59 PM
date find using find method x taol Excel Programming 2 December 22nd 05 09:51 AM
Using variables to make a date and using find method to find that. KyWilde Excel Programming 2 April 21st 05 09:43 PM
Find method nk Excel Programming 2 April 16th 05 01:50 PM
Find method Alan Beban[_2_] Excel Programming 0 September 22nd 04 09:38 PM


All times are GMT +1. The time now is 07:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"