Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 28
Default Filters and subtotals

Hi

I have a number of workbooks, for which I would like to refresh the data
(pulling info from another workbook using MS Query) that is in each.

What I wish to end up with, in each workbook: is my data refreshed; filters
applied to the columns; and subtotalling applied.

I had produced a macro to do this and it did seem fine until it encounters a
workbook that has either filters or subtotalling already applied.

My problem is that the workbooks won't always be in the same format (i.e.
some will have these applied, others won't) when I want to update the
information.

What is the function to apply filtering and subtotalling if these are not
already applied - but if they are already applied, remove them and reapply
them after the data refresh?


Thanks


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Filters and subtotals

First, I wouldn't use Autofilter and subtotals on the same range. They don't
play nice since each uses visible rows to do their counts/sums/averages...

Option Explicit
Sub testme()

Dim wks As Worksheet
Set wks = Worksheets("Sheet1")

With wks
.AutoFilterMode = False
.Cells.RemoveSubtotal
End With

End Sub


BabyMc wrote:

Hi

I have a number of workbooks, for which I would like to refresh the data
(pulling info from another workbook using MS Query) that is in each.

What I wish to end up with, in each workbook: is my data refreshed; filters
applied to the columns; and subtotalling applied.

I had produced a macro to do this and it did seem fine until it encounters a
workbook that has either filters or subtotalling already applied.

My problem is that the workbooks won't always be in the same format (i.e.
some will have these applied, others won't) when I want to update the
information.

What is the function to apply filtering and subtotalling if these are not
already applied - but if they are already applied, remove them and reapply
them after the data refresh?

Thanks


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 28
Default Filters and subtotals

Dave

Just a quick note to thank you for your suggestion - and apologies for not
replying sooner (despite requesting such, I do not seem to be notified of
replies to my posting) - I have been away and am now busy on other tasks.

However I will try your solution as soon as I have the opportunity.


"Dave Peterson" wrote:

First, I wouldn't use Autofilter and subtotals on the same range. They don't
play nice since each uses visible rows to do their counts/sums/averages...

Option Explicit
Sub testme()

Dim wks As Worksheet
Set wks = Worksheets("Sheet1")

With wks
.AutoFilterMode = False
.Cells.RemoveSubtotal
End With

End Sub


BabyMc wrote:

Hi

I have a number of workbooks, for which I would like to refresh the data
(pulling info from another workbook using MS Query) that is in each.

What I wish to end up with, in each workbook: is my data refreshed; filters
applied to the columns; and subtotalling applied.

I had produced a macro to do this and it did seem fine until it encounters a
workbook that has either filters or subtotalling already applied.

My problem is that the workbooks won't always be in the same format (i.e.
some will have these applied, others won't) when I want to update the
information.

What is the function to apply filtering and subtotalling if these are not
already applied - but if they are already applied, remove them and reapply
them after the data refresh?

Thanks


--

Dave Peterson
.

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
Subtotals and filters smartgal Excel Discussion (Misc queries) 1 July 6th 09 06:20 PM
Pivot Table filters, especially DATE filters chris Excel Worksheet Functions 0 August 27th 08 04:33 AM
update subtotals based on filters Ned Fraser Excel Worksheet Functions 3 March 22nd 07 02:08 AM
Filters, Subtotal & Intacted Results after the filters' Removal kasiopi Excel Discussion (Misc queries) 5 February 24th 06 12:18 PM
Subtotals & Filters BAM718 Excel Worksheet Functions 3 June 13th 05 11:49 PM


All times are GMT +1. The time now is 08:56 AM.

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"