Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Subtotal in Autofilter Referencing

I import data which is parsed and formatted by VB. In the end, I set an Auto
filter so I can do my analysis. What I am trying to accomplish is to have the
macro put in the subtotal(9,.....) for me. The data length is variable, but
obviously I am not referencing things correctly because I am getting an
error. Perhaps there is even a better way to accomplish what I want.

Thanks


Dim Maxrows As Long
Maxrows = ActiveSheet.UsedRange.Rows.Count
Cells(Maxrows + 3, 5).Select
ActiveCell.Formula = "=SUBTOTAL(9,range(cells(2,5),cells(maxrows,5) "
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default Subtotal in Autofilter Referencing

Hi Bob,

if you try this you should get a result.
I used =SUBTOTAL(109,....) to get only the SUM of visible rows.

Dim lastRow As Long
lastRow = Cells(2, 5).End(xlDown).Row

Cells(lastRow + 3, 5).Select
ActiveCell.Formula = "=Subtotal(109, E2:" & _
Cells(lastRow, 5).Address & ")"

HTH,

Wouter
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 Subtotal [email protected] Excel Programming 1 April 2nd 08 01:02 AM
Autofilter with Subtotal Sumif Robert Christie Excel Worksheet Functions 10 August 3rd 07 12:12 AM
SUMPRODUCT and (perhaps) SUBTOTAL with AUTOFILTER Donovan Excel Worksheet Functions 4 June 9th 06 12:06 AM
Subtotal on Autofilter with Countif JavyD Excel Worksheet Functions 4 March 22nd 06 07:45 PM
Referencing subtotal numbers Arun Excel Worksheet Functions 10 March 1st 06 10:10 PM


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