ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Auto-filter. Cursor on first row in new list (https://www.excelbanter.com/excel-programming/383477-auto-filter-cursor-first-row-new-list.html)

John[_129_]

Auto-filter. Cursor on first row in new list
 
Hi,

Is there any way to get the cursor to go to the first row of a filtered list
when Autofilter is used?

Thanks,

John



Tom Ogilvy

Auto-filter. Cursor on first row in new list
 
Dim rng as Range, rng1 as range
set rng = Activesheet.Autofilter.Range.Columns(1).Cells
set rng = rng.offset(1,0).Resize(rng.rows.count - 1)
on error resume next
set rng1 = rng.SpecialCells(xlVisible)
On error goto 0
if not rng1 is Nothing then
rng1(1).Select
end if

--
Regards,
Tom Ogilvy


"John" wrote in message
...
Hi,

Is there any way to get the cursor to go to the first row of a filtered
list when Autofilter is used?

Thanks,

John




John[_129_]

Auto-filter. Cursor on first row in new list
 
Thanks Tom. Where would I put this code to have it run when I use the
AutoFilter drop down list on the worksheet?

John

"Tom Ogilvy" wrote in message
...
Dim rng as Range, rng1 as range
set rng = Activesheet.Autofilter.Range.Columns(1).Cells
set rng = rng.offset(1,0).Resize(rng.rows.count - 1)
on error resume next
set rng1 = rng.SpecialCells(xlVisible)
On error goto 0
if not rng1 is Nothing then
rng1(1).Select
end if

--
Regards,
Tom Ogilvy


"John" wrote in message
...
Hi,

Is there any way to get the cursor to go to the first row of a filtered
list when Autofilter is used?

Thanks,

John






John[_129_]

Auto-filter. Cursor on first row in new list
 
I combined your suggestion with this:
http://www.excelforum.com/archive/in.../t-503428.html

And it works fine. Thank you.


"Tom Ogilvy" wrote in message
...
Dim rng as Range, rng1 as range
set rng = Activesheet.Autofilter.Range.Columns(1).Cells
set rng = rng.offset(1,0).Resize(rng.rows.count - 1)
on error resume next
set rng1 = rng.SpecialCells(xlVisible)
On error goto 0
if not rng1 is Nothing then
rng1(1).Select
end if

--
Regards,
Tom Ogilvy


"John" wrote in message
...
Hi,

Is there any way to get the cursor to go to the first row of a filtered
list when Autofilter is used?

Thanks,

John







All times are GMT +1. The time now is 04:58 PM.

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