Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default REMOVING COLUMN FILTERS VIA VB CODE

Anyone know how to remove column filters via VB code? I'm trying to
code for an automated macro.. Thanks in advance..
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default REMOVING COLUMN FILTERS VIA VB CODE

"clawdogs" wrote in message
...
Anyone know how to remove column filters via VB code? I'm trying to
code for an automated macro.. Thanks in advance..



Have you tried using the macro recorder while manually making the
changes you are interested in and then examining the code?

--
Clif McIrvin

(clare reads his mail with moe, nomail feeds the bit bucket :-)


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default REMOVING COLUMN FILTERS VIA VB CODE

On Sep 23, 11:24*am, "Clif McIrvin" wrote:
"clawdogs" wrote in message

...

Anyone know how to remove column filters via VB code? *I'm trying to
code for an automated macro.. *Thanks in advance..


Have you tried using the macro recorder while manually making the
changes you are interested in and then examining the code?

--
Clif McIrvin

(clare reads his mail with moe, nomail feeds the bit bucket :-)


yes, that won't work if filters are already off. it will then include
filters
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default REMOVING COLUMN FILTERS VIA VB CODE

clawdogs pretended :
Anyone know how to remove column filters via VB code? I'm trying to
code for an automated macro.. Thanks in advance..


Google FilterMode property in online help (F1)!

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default REMOVING COLUMN FILTERS VIA VB CODE

"clawdogs" wrote in message
...
On Sep 23, 11:24 am, "Clif McIrvin" wrote:
"clawdogs" wrote in message

...

Anyone know how to remove column filters via VB code? I'm trying to
code for an automated macro.. Thanks in advance..


Have you tried using the macro recorder while manually making the
changes you are interested in and then examining the code?

--
Clif McIrvin

(clare reads his mail with moe, nomail feeds the bit bucket :-)


yes, that won't work if filters are already off. it will then include
filters

The obvious recommendation would then be.... do it a second time after it
includes filters and you will have the code to remove them ???



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default REMOVING COLUMN FILTERS VIA VB CODE

MerseyBeat explained on 9/23/2011 :
"clawdogs" wrote in message
...
On Sep 23, 11:24 am, "Clif McIrvin" wrote:
"clawdogs" wrote in message

...

Anyone know how to remove column filters via VB code? I'm trying to
code for an automated macro.. Thanks in advance..


Have you tried using the macro recorder while manually making the
changes you are interested in and then examining the code?

--
Clif McIrvin

(clare reads his mail with moe, nomail feeds the bit bucket :-)


yes, that won't work if filters are already off. it will then include
filters

The obvious recommendation would then be.... do it a second time after it
includes filters and you will have the code to remove them ???


With ActiveSheet
If .FilterMode Then .AutoFilter '//turn it off
Wnd With 'ActiveSheet

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default REMOVING COLUMN FILTERS VIA VB CODE

GS made a typo...:
With ActiveSheet
If .FilterMode Then .AutoFilter '//turn it off

End With 'ActiveSheet

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default REMOVING COLUMN FILTERS VIA VB CODE

There's a bit more to it that I didn't consider... (my bad!)

AutoFilter
Must be used with a range of contiguous cells
This toggles the filter dropdowns

FilterMode
True if rows are filtered;
False if rows are not filtered (even when the dropdowns exist)

AutoFilterMode
True if dropdowns exist;
False if no dropdowns exist

So.., my reply should have been as follows...

With ActiveSheet
If .AutoFilterMode Then .UsedRange.AutoFilter '//turn it off
End With 'ActiveSheet

If rows are filtered:
ActiveSheet.FilterMode is True
ActiveSheet.AutoFilterMode is True

If rows are not filtered:
Dropdowns exist:
ActiveSheet.FilterMode is False
ActiveSheet.AutoFilterMode is True

Dropdowns do not exist:
ActiveSheet.FilterMode is False
ActiveSheet.AutoFilterMode is False

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 420
Default REMOVING COLUMN FILTERS VIA VB CODE

Saved from a previous post:

If turn the autofilter off means remove all the arrows and show all the data:

dim wks as worksheet
set wks = worksheets("Somesheetname")
wks.autofiltermode = false


If turn off just means that you show all the data and keep the arrows:

dim wks as worksheet
set wks = worksheets("Somesheetname")
with wks
'show all the data
If .FilterMode Then
.ShowAllData
End If
end with

On 09/23/2011 10:01, clawdogs wrote:
Anyone know how to remove column filters via VB code? I'm trying to
code for an automated macro.. Thanks in advance..


--
Dave Peterson
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default REMOVING COLUMN FILTERS VIA VB CODE

On Sep 24, 7:42*am, Dave Peterson wrote:
Saved from a previous post:

If turn the autofilter off means remove all the arrows and show all the data:

dim wks as worksheet
set wks = worksheets("Somesheetname")
wks.autofiltermode = false

If turn off just means that you show all the data and keep the arrows:

dim wks as worksheet
set wks = worksheets("Somesheetname")
with wks
* * 'show all the data
* * If .FilterMode Then
* * * *.ShowAllData
* * End If
end with

On 09/23/2011 10:01, clawdogs wrote:

Anyone know how to remove column filters via VB code? *I'm trying to
code for an automated macro.. *Thanks in advance..


--
Dave Peterson

Guys, thanks a bunch!
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
Removing filters from data Philip J Smith Excel Programming 1 January 29th 10 12:04 PM
Programmatically removing data filters PatK Excel Programming 12 August 14th 08 12:09 AM
Multiple Column filters Kristinf Excel Discussion (Misc queries) 5 July 18th 07 08:25 PM
Code to control auto filters Gordon[_2_] Excel Programming 1 January 20th 06 04:26 PM
code for auto filters Gordon[_2_] Excel Programming 2 January 20th 06 11:29 AM


All times are GMT +1. The time now is 07:10 PM.

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"