Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Find, Findnext VBA Loop

I am using a Find, FindNext loop in a vba macro in Excel XP professional on
a Windows 2000 platform.

The procedure works fine with the exception of finding the SECOND instance
of the criteria and not the first when the criteria is met in the first row
of the search range.

I presume this is the default.

The only methods I am adding are Lookin xlValues and Lookat xlWhole.

How can I enforce finding the first instance.

I have, for now used a workaround of redfining the search range with an
additional top row.
This is however hardly very elegant nor usable in all instances.

Can anyone assist


Regards

John Howard
Sydney, Australia


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Find, Findnext VBA Loop

Hi
you may post your existing code (the find/findnext loop)

"SMS - John Howard" wrote:

I am using a Find, FindNext loop in a vba macro in Excel XP professional on
a Windows 2000 platform.

The procedure works fine with the exception of finding the SECOND instance
of the criteria and not the first when the criteria is met in the first row
of the search range.

I presume this is the default.

The only methods I am adding are Lookin xlValues and Lookat xlWhole.

How can I enforce finding the first instance.

I have, for now used a workaround of redfining the search range with an
additional top row.
This is however hardly very elegant nor usable in all instances.

Can anyone assist


Regards

John Howard
Sydney, Australia



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default Find, Findnext VBA Loop

SMS - John Howard wrote:
I am using a Find, FindNext loop in a vba macro in Excel XP professional on
a Windows 2000 platform.

The procedure works fine with the exception of finding the SECOND instance
of the criteria and not the first when the criteria is met in the first row
of the search range.

I presume this is the default.

The only methods I am adding are Lookin xlValues and Lookat xlWhole.

How can I enforce finding the first instance.

I have, for now used a workaround of redfining the search range with an
additional top row.
This is however hardly very elegant nor usable in all instances.

Can anyone assist


Regards

John Howard
Sydney, Australia


Add a second parameter After:=[the last cell in the range]

Alan Beban
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Find, Findnext VBA Loop

John
To add to what Alan gave you. If your range is a variable, say,
MyRange, then use:
After:=MyRange(MyRange.Count)
HTH Otto
"SMS - John Howard" wrote in message
...
I am using a Find, FindNext loop in a vba macro in Excel XP professional on
a Windows 2000 platform.

The procedure works fine with the exception of finding the SECOND instance
of the criteria and not the first when the criteria is met in the first
row
of the search range.

I presume this is the default.

The only methods I am adding are Lookin xlValues and Lookat xlWhole.

How can I enforce finding the first instance.

I have, for now used a workaround of redfining the search range with an
additional top row.
This is however hardly very elegant nor usable in all instances.

Can anyone assist


Regards

John Howard
Sydney, Australia




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Find, Findnext VBA Loop

Alan and Otto,

Many thanks.
Your solutions worked perfectly

Regards

John Howard
Sydney, Australia


"SMS - John Howard" wrote in message
...
I am using a Find, FindNext loop in a vba macro in Excel XP professional

on
a Windows 2000 platform.

The procedure works fine with the exception of finding the SECOND instance
of the criteria and not the first when the criteria is met in the first

row
of the search range.

I presume this is the default.

The only methods I am adding are Lookin xlValues and Lookat xlWhole.

How can I enforce finding the first instance.

I have, for now used a workaround of redfining the search range with an
additional top row.
This is however hardly very elegant nor usable in all instances.

Can anyone assist


Regards

John Howard
Sydney, Australia






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default Find, Findnext VBA Loop

SMS - John Howard wrote:
Alan and Otto,

Many thanks.
Your solutions worked perfectly

Regards

John Howard
Sydney, Australia


You're welcome. Thanks for the feedback.

Alan Beban
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
Find loop doesn't loop JSnow Excel Discussion (Misc queries) 2 June 24th 09 08:28 PM
Find & loop in VBA Noemi Excel Discussion (Misc queries) 3 January 25th 06 03:39 AM
Find, Loop, Subtotal Adresmith[_10_] Excel Programming 1 October 29th 04 10:28 PM
Find...FindNext Problem mtsark Excel Programming 4 August 19th 04 04:09 PM
Find loop Jamie[_8_] Excel Programming 2 April 22nd 04 10:00 PM


All times are GMT +1. The time now is 06:41 PM.

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"