Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Dennis
 
Posts: n/a
Default VBA code to locate cell address of AutoFilter dropdown box

XL 2003

What VBA code line would return the cell address of the cell containing the
AutoFilter dropdown box in a particular column

The line below does not work but gives an idea what I am looking for.

ActiveSheet.Autofilter.Address

Dennis
  #2   Report Post  
Bernie Deitrick
 
Posts: n/a
Default

Dennis,

Try the code below.

HTH,
Bernie
MS Excel MVP

Sub Test()
Dim i As Integer
Dim mySheet As Worksheet
Set mySheet = ActiveSheet
Dim myFilters As String

myFilters = ""

For i = 1 To mySheet.AutoFilter.Range.Columns.Count
If mySheet.AutoFilter.Filters(i).On Then
myFilters = myFilters & mySheet.AutoFilter.Range _
.Cells(1, i).Address(False, False) & " & "
End If
Next i

MsgBox mySheet.Name & " range " & _
mySheet.AutoFilter.Range.Address & Chr(10) & _
"is filtered by cell(s) " & _
Left(myFilters, Len(myFilters) - 3)

End Sub



"Dennis" wrote in message
...
XL 2003

What VBA code line would return the cell address of the cell containing the
AutoFilter dropdown box in a particular column

The line below does not work but gives an idea what I am looking for.

ActiveSheet.Autofilter.Address

Dennis



  #3   Report Post  
Earl Kiosterud
 
Posts: n/a
Default

Dennis

ActiveSheet.AutoFilter.Range.Row gives you the number of the heading row,
which contains the dropdowns.

The following will select the first one.
Roww = ActiveSheet.AutoFilter.Range.Row
Coll = ActiveSheet.AutoFilter.Range.Column
Cells(Roww, Coll).Select
--
Earl Kiosterud
www.smokeylake.com

"Dennis" wrote in message
...
XL 2003

What VBA code line would return the cell address of the cell containing
the
AutoFilter dropdown box in a particular column

The line below does not work but gives an idea what I am looking for.

ActiveSheet.Autofilter.Address

Dennis



  #4   Report Post  
Dennis
 
Posts: n/a
Default

Thanks to both of you!

Different approaches both very useful.

I was close, but VBA likes neither horseshoes nor hand-grenades.

Dennis

*****************************************

"Dennis" wrote:

XL 2003

What VBA code line would return the cell address of the cell containing the
AutoFilter dropdown box in a particular column

The line below does not work but gives an idea what I am looking for.

ActiveSheet.Autofilter.Address

Dennis

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
Macro for changing text to Proper Case JPriest Excel Worksheet Functions 3 August 8th 05 09:31 PM
Find the cell value in excel by using vb code Michael Excel Discussion (Misc queries) 5 June 14th 05 01:24 PM
Possible Lookup Table Karen Excel Worksheet Functions 5 June 8th 05 09:43 PM
in excel I want to set up a drop down & link that to another cell Corminator Excel Worksheet Functions 5 June 4th 05 09:20 PM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM


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