ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find, Findnext VBA Loop (https://www.excelbanter.com/excel-programming/316560-find-findnext-vba-loop.html)

SMS - John Howard

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



Frank Kabel

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




Alan Beban[_2_]

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

Otto Moehrbach[_6_]

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





SMS - John Howard

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





Alan Beban[_2_]

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


All times are GMT +1. The time now is 09:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com