Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default autofilter : how to go to next row ?

Hello,
I'm searching the correct syntax to go the the next cell(s) when autofilter
is active.
When I do activeCell.Offset(1,0).Select, it goes to a row which is not part
of the autofilter criterias.
Many thanks for your valuable help.

François
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default autofilter : how to go to next row ?

do
ActiveCell.Offset(1,0).Select
Loop until activecell.EntireRow.Hidden = False


--
Regards,
Tom Ogilvy


"François" wrote in message
...
Hello,
I'm searching the correct syntax to go the the next cell(s) when

autofilter
is active.
When I do activeCell.Offset(1,0).Select, it goes to a row which is not

part
of the autofilter criterias.
Many thanks for your valuable help.

François



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default autofilter : how to go to next row ?

Tom,

This response is elegant in its simplicity, but it seems to me that there
must be a better way. I have a lot that I want to do with filtered lists in
VBA so I'm real interested in this topic.

What I mean is this: when I'm on an Excel sheet that is AutoFiltered, I can
use the arrow keys to immediately move from one item in the filtered list to
the next item. As far as I can tell, there's no way to do this via VBA. The
method you mentioned in your post, for example, loops through every invisible
cell in between just to get to the next member of the filtered list. My
question is, isn't there a way to simply move from one visible cell to
another in VBA like I can in Excel?

My understanding is the one of VBA's disadvantages is speed, and that's why
I'm concerned with overtaxing the CPU unnecessarily.

An alternative I've come up with is to copy the filtered list to another
sheet and then step through it. Is this the best way?
"Tom Ogilvy" wrote:

do
ActiveCell.Offset(1,0).Select
Loop until activecell.EntireRow.Hidden = False


--
Regards,
Tom Ogilvy


"François" wrote in message
...
Hello,
I'm searching the correct syntax to go the the next cell(s) when

autofilter
is active.
When I do activeCell.Offset(1,0).Select, it goes to a row which is not

part
of the autofilter criterias.
Many thanks for your valuable help.

François




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default autofilter : how to go to next row ?

It depends on what you want to do. I can certainly get a reference to all
the visible rows.

Dim rng as Range, rng1 as Range, cell as Range
set rng = ActiveSheet.Autofilter.Range.Columns(1)
set rng = rng.offset(1,0).Resize(rng.rows.count,1)
set rng1 = rng.specialcells(xlVisible)
if not rng1 is nothing then
' there are visible rows besides the header
for each cell in rng1
msgbox cell.Address
Next
end if


As far as looping, if you working on a huge database and there would be
hundred of hidden rows between visible rows, then it probably would be an
issue. But most people are not.

--
Regards,
Tom Ogilvy



"T_o_n_y" wrote in message
...
Tom,

This response is elegant in its simplicity, but it seems to me that there
must be a better way. I have a lot that I want to do with filtered lists

in
VBA so I'm real interested in this topic.

What I mean is this: when I'm on an Excel sheet that is AutoFiltered, I

can
use the arrow keys to immediately move from one item in the filtered list

to
the next item. As far as I can tell, there's no way to do this via VBA.

The
method you mentioned in your post, for example, loops through every

invisible
cell in between just to get to the next member of the filtered list. My
question is, isn't there a way to simply move from one visible cell to
another in VBA like I can in Excel?

My understanding is the one of VBA's disadvantages is speed, and that's

why
I'm concerned with overtaxing the CPU unnecessarily.

An alternative I've come up with is to copy the filtered list to another
sheet and then step through it. Is this the best way?
"Tom Ogilvy" wrote:

do
ActiveCell.Offset(1,0).Select
Loop until activecell.EntireRow.Hidden = False


--
Regards,
Tom Ogilvy


"François" wrote in message
...
Hello,
I'm searching the correct syntax to go the the next cell(s) when

autofilter
is active.
When I do activeCell.Offset(1,0).Select, it goes to a row which is not

part
of the autofilter criterias.
Many thanks for your valuable help.

François






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default autofilter : how to go to next row ?

Tom,

I learned much from this example. Thank you. I've also learned a lot from
your other posts. I really appreciate the help.



"Tom Ogilvy" wrote:

It depends on what you want to do. I can certainly get a reference to all
the visible rows.

Dim rng as Range, rng1 as Range, cell as Range
set rng = ActiveSheet.Autofilter.Range.Columns(1)
set rng = rng.offset(1,0).Resize(rng.rows.count,1)
set rng1 = rng.specialcells(xlVisible)
if not rng1 is nothing then
' there are visible rows besides the header
for each cell in rng1
msgbox cell.Address
Next
end if


As far as looping, if you working on a huge database and there would be
hundred of hidden rows between visible rows, then it probably would be an
issue. But most people are not.

--
Regards,
Tom Ogilvy



"T_o_n_y" wrote in message
...
Tom,

This response is elegant in its simplicity, but it seems to me that there
must be a better way. I have a lot that I want to do with filtered lists

in
VBA so I'm real interested in this topic.

What I mean is this: when I'm on an Excel sheet that is AutoFiltered, I

can
use the arrow keys to immediately move from one item in the filtered list

to
the next item. As far as I can tell, there's no way to do this via VBA.

The
method you mentioned in your post, for example, loops through every

invisible
cell in between just to get to the next member of the filtered list. My
question is, isn't there a way to simply move from one visible cell to
another in VBA like I can in Excel?

My understanding is the one of VBA's disadvantages is speed, and that's

why
I'm concerned with overtaxing the CPU unnecessarily.

An alternative I've come up with is to copy the filtered list to another
sheet and then step through it. Is this the best way?
"Tom Ogilvy" wrote:

do
ActiveCell.Offset(1,0).Select
Loop until activecell.EntireRow.Hidden = False


--
Regards,
Tom Ogilvy


"François" wrote in message
...
Hello,
I'm searching the correct syntax to go the the next cell(s) when
autofilter
is active.
When I do activeCell.Offset(1,0).Select, it goes to a row which is not
part
of the autofilter criterias.
Many thanks for your valuable help.

François






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
excel 2007 autofilter change to 2003 autofilter functionality? jonnybrovo815 Excel Discussion (Misc queries) 1 April 19th 10 10:05 PM
2007 excel autofilter back to 2003 autofilter? jonnybrovo815 Excel Discussion (Misc queries) 3 April 19th 10 08:11 PM
2007 excel autofilter change back to 2003 autofilter? jonnybrovo815 Excel Discussion (Misc queries) 1 April 19th 10 05:53 PM
2007 Autofilter worse than 2003 Autofilter jsky Excel Discussion (Misc queries) 9 October 31st 07 12:14 AM
How to Sort within AutoFilter with Protection on (and AutoFilter . giblon Excel Discussion (Misc queries) 1 February 16th 06 12:23 PM


All times are GMT +1. The time now is 09:17 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"