Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Find Autofilter Header range

I have code from this community to 'reset' the autofilter for each worksheet
where AutoFilterMode = true (Thanks Patrick Molloy)
I see that I need to specify the target range for the filter headers
In my workbook filter headers may be on row 1, row 2 , etc
Is there a way to determine for each worksheet where the filter headers are
located?
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Find Autofilter Header range

By reset if you mean remove autofilter or show all data

Dim sh as Worksheet
For each Sh in ActiveWorkbook.Worksheets
'to remove autofilter
'Sh.AutoFilterMode = False
Sh.ShowAllData
Next

If this post helps click Yes
---------------
Jacob Skaria


"David" wrote:

I have code from this community to 'reset' the autofilter for each worksheet
where AutoFilterMode = true (Thanks Patrick Molloy)
I see that I need to specify the target range for the filter headers
In my workbook filter headers may be on row 1, row 2 , etc
Is there a way to determine for each worksheet where the filter headers are
located?
Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Find Autofilter Header range

Jacob
Thanks for your response
By 'reset' I meant remove and re-apply the autofilter on sheets where it
exists
like this:

I ned to identify the Autofiltercolumn header range in the code below as in
the title of th op

Dim wks as worksheet
For each wks in ThisWorkbook.Worksheets
If wks.AutofilterMode Then
Dim target as range
Set target = range("MyAutofilterHeaderRange")
'turn filter off
target.autofilter
'turn filter back on again
target.autofilter
End if
Next wks



"Jacob Skaria" wrote:

By reset if you mean remove autofilter or show all data

Dim sh as Worksheet
For each Sh in ActiveWorkbook.Worksheets
'to remove autofilter
'Sh.AutoFilterMode = False
Sh.ShowAllData
Next

If this post helps click Yes
---------------
Jacob Skaria


"David" wrote:

I have code from this community to 'reset' the autofilter for each worksheet
where AutoFilterMode = true (Thanks Patrick Molloy)
I see that I need to specify the target range for the filter headers
In my workbook filter headers may be on row 1, row 2 , etc
Is there a way to determine for each worksheet where the filter headers are
located?
Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Find Autofilter Header range

Option Explicit
Sub ResetFilters()
Dim target As Range
Dim ws As Worksheet
For Each ws In Worksheets
If ws.AutoFilterMode = True Then
Set target = ws.AutoFilter.Range
target.AutoFilter
target.AutoFilter
End If
Next
End Sub


"David" wrote:

I have code from this community to 'reset' the autofilter for each worksheet
where AutoFilterMode = true (Thanks Patrick Molloy)
I see that I need to specify the target range for the filter headers
In my workbook filter headers may be on row 1, row 2 , etc
Is there a way to determine for each worksheet where the filter headers are
located?
Thanks

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Find Autofilter Header range

Patrick
You are a star
Thanks

"Patrick Molloy" wrote:

Option Explicit
Sub ResetFilters()
Dim target As Range
Dim ws As Worksheet
For Each ws In Worksheets
If ws.AutoFilterMode = True Then
Set target = ws.AutoFilter.Range
target.AutoFilter
target.AutoFilter
End If
Next
End Sub


"David" wrote:

I have code from this community to 'reset' the autofilter for each worksheet
where AutoFilterMode = true (Thanks Patrick Molloy)
I see that I need to specify the target range for the filter headers
In my workbook filter headers may be on row 1, row 2 , etc
Is there a way to determine for each worksheet where the filter headers are
located?
Thanks



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Find Autofilter Header range

actually, look at your own reply to Jacob . .. I pretty much stole your own
code ;)


"David" wrote:

Patrick
You are a star
Thanks

"Patrick Molloy" wrote:

Option Explicit
Sub ResetFilters()
Dim target As Range
Dim ws As Worksheet
For Each ws In Worksheets
If ws.AutoFilterMode = True Then
Set target = ws.AutoFilter.Range
target.AutoFilter
target.AutoFilter
End If
Next
End Sub


"David" wrote:

I have code from this community to 'reset' the autofilter for each worksheet
where AutoFilterMode = true (Thanks Patrick Molloy)
I see that I need to specify the target range for the filter headers
In my workbook filter headers may be on row 1, row 2 , etc
Is there a way to determine for each worksheet where the filter headers are
located?
Thanks

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
Autofilter header row Mister Cul-de-sac Excel Discussion (Misc queries) 3 April 11th 10 04:46 PM
AutoFilter Selection to Change Page Header Darrell Lankford Excel Programming 0 April 29th 08 06:38 PM
Cells.find only reporting range in AutoFilter... mark Excel Programming 4 October 30th 07 03:29 PM
AutoFilter Header Row bgetson Excel Programming 6 August 18th 07 02:45 AM
Error proof way to find first blank Row after Autofilter Range [email protected] Excel Programming 6 July 1st 07 01:42 AM


All times are GMT +1. The time now is 04:26 AM.

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"