Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default How do I select the first cell of a filtered list?


I have an autofilter on a column with 300+ rows.

If I filter on that column, how can I reference/extract the contents of
the very first row returned from the filter even when that first row may
have an 'actual' row number of 178 (or whatever)?

Thanks,

Shane.


--
Shane Moore
------------------------------------------------------------------------
Shane Moore's Profile: http://www.excelforum.com/member.php...o&userid=36421
View this thread: http://www.excelforum.com/showthread...hreadid=571682

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default How do I select the first cell of a filtered list?

In code???

One way:

Option Explicit
Sub testme()

Dim myCell As Range

Set myCell = Nothing
On Error Resume Next
With ActiveSheet.AutoFilter.Range
Set myCell = .Resize(.Rows.Count - 1, 1).Offset(1, 0) _
.Cells.SpecialCells(xlCellTypeVisible).Cells(1)
End With
On Error GoTo 0

If myCell Is Nothing Then
'do nothing
Else
MsgBox myCell.Row
'mycell.entirerow.select '????
End If
End Sub

(No validation to make sure the worksheet is filtered.)

Shane Moore wrote:

I have an autofilter on a column with 300+ rows.

If I filter on that column, how can I reference/extract the contents of
the very first row returned from the filter even when that first row may
have an 'actual' row number of 178 (or whatever)?

Thanks,

Shane.

--
Shane Moore
------------------------------------------------------------------------
Shane Moore's Profile: http://www.excelforum.com/member.php...o&userid=36421
View this thread: http://www.excelforum.com/showthread...hreadid=571682


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,441
Default How do I select the first cell of a filtered list?

Shane,

You need to add another column to your table. Let's say that your table is in columns A to C, with
headers in row 1. Insert a new column A, so that your table is in columns B to D, and in cell A2,
enter the formula

=SUBTOTAL(3,$C$2:C2)

and copy down that down column A to match your table.

Then use the formula

=VLOOKUP(1,$A$1:$D$300,3,FALSE)

to return the first visible value from column C.

HTH,
Bernie
MS Excel MVP


"Shane Moore" wrote in message
...

I have an autofilter on a column with 300+ rows.

If I filter on that column, how can I reference/extract the contents of
the very first row returned from the filter even when that first row may
have an 'actual' row number of 178 (or whatever)?

Thanks,

Shane.


--
Shane Moore
------------------------------------------------------------------------
Shane Moore's Profile: http://www.excelforum.com/member.php...o&userid=36421
View this thread: http://www.excelforum.com/showthread...hreadid=571682



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
auto updating list Larry Excel Worksheet Functions 8 July 27th 06 01:59 PM
select last cell in a dynamic list using a macro uncrox Excel Discussion (Misc queries) 4 July 19th 06 01:27 PM
Excel 2007 B2 - Selecting every cell that starts with a certain word [email protected] Excel Discussion (Misc queries) 13 July 9th 06 09:08 PM
Color cell validation? jjh Excel Discussion (Misc queries) 4 July 9th 06 02:04 AM
How do I Select Multiple entries from Valid list for a Cell WIDBIS Excel Discussion (Misc queries) 1 June 29th 05 12:53 AM


All times are GMT +1. The time now is 05:50 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"