ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Minimum qualifiers to Find (VBA) the actual last used Row, Column (https://www.excelbanter.com/excel-discussion-misc-queries/102241-minimum-qualifiers-find-vba-actual-last-used-row-column.html)

EagleOne

Minimum qualifiers to Find (VBA) the actual last used Row, Column
 
2003

Have played with the following VBA code arguments but all seem to give
same result whether included or excluded:

Cells.Find( _
What:="*", _
after:=ActiveSheet.Cells(1, 1), _
LookIn:=xlFormulas, _
lookat:=xlWhole, _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByRows) _
.Row

What is the minimum set of arguements to always fine the last used row?


Why does not appear to make any difference to the end result, if I
include or exclude the following - what am I missing?
after:=ActiveSheet.Cells(1, 1), _
LookIn:=xlFormulas, _
lookat:=xlWhole, _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByRows) _
.Row

Thanks, EagleOne


Dave Peterson

Minimum qualifiers to Find (VBA) the actual last used Row, Column
 
Excel and VBA work together with .Find. They each remember the parameters in
the previous Find (either manually or via code).

Because of this, your testing is just testing the last set of parms that were
used. And that's one very good reason to specify all the parms you want--if you
don't specify them, then you'll be trusting that the last Find that was done
used the same parms as the ones you want.



EagleOne wrote:

2003

Have played with the following VBA code arguments but all seem to give
same result whether included or excluded:

Cells.Find( _
What:="*", _
after:=ActiveSheet.Cells(1, 1), _
LookIn:=xlFormulas, _
lookat:=xlWhole, _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByRows) _
.Row

What is the minimum set of arguements to always fine the last used row?

Why does not appear to make any difference to the end result, if I
include or exclude the following - what am I missing?
after:=ActiveSheet.Cells(1, 1), _
LookIn:=xlFormulas, _
lookat:=xlWhole, _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByRows) _
.Row

Thanks, EagleOne


--

Dave Peterson

EagleOne

Minimum qualifiers to Find (VBA) the actual last used Row, Column
 
Very interesting!

Dave, what other Excel/VBA functions "remember" previous settings?

EagleOne


Dave Peterson wrote:
Excel and VBA work together with .Find. They each remember the parameters in
the previous Find (either manually or via code).

Because of this, your testing is just testing the last set of parms that were
used. And that's one very good reason to specify all the parms you want--if you
don't specify them, then you'll be trusting that the last Find that was done
used the same parms as the ones you want.



EagleOne wrote:

2003

Have played with the following VBA code arguments but all seem to give
same result whether included or excluded:

Cells.Find( _
What:="*", _
after:=ActiveSheet.Cells(1, 1), _
LookIn:=xlFormulas, _
lookat:=xlWhole, _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByRows) _
.Row

What is the minimum set of arguements to always fine the last used row?

Why does not appear to make any difference to the end result, if I
include or exclude the following - what am I missing?
after:=ActiveSheet.Cells(1, 1), _
LookIn:=xlFormulas, _
lookat:=xlWhole, _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByRows) _
.Row

Thanks, EagleOne


--

Dave Peterson



Dave Peterson

Minimum qualifiers to Find (VBA) the actual last used Row, Column
 
I don't know.

I do know that data|text to columns tries to help when you do it one time, then
paste from a different application.

EagleOne wrote:

Very interesting!

Dave, what other Excel/VBA functions "remember" previous settings?

EagleOne

Dave Peterson wrote:
Excel and VBA work together with .Find. They each remember the parameters in
the previous Find (either manually or via code).

Because of this, your testing is just testing the last set of parms that were
used. And that's one very good reason to specify all the parms you want--if you
don't specify them, then you'll be trusting that the last Find that was done
used the same parms as the ones you want.



EagleOne wrote:

2003

Have played with the following VBA code arguments but all seem to give
same result whether included or excluded:

Cells.Find( _
What:="*", _
after:=ActiveSheet.Cells(1, 1), _
LookIn:=xlFormulas, _
lookat:=xlWhole, _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByRows) _
.Row

What is the minimum set of arguements to always fine the last used row?

Why does not appear to make any difference to the end result, if I
include or exclude the following - what am I missing?
after:=ActiveSheet.Cells(1, 1), _
LookIn:=xlFormulas, _
lookat:=xlWhole, _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByRows) _
.Row

Thanks, EagleOne


--

Dave Peterson


--

Dave Peterson


All times are GMT +1. The time now is 01:14 AM.

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