LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default I'm trying to do a "count" function at the end of a dynamic pivot table

It has been a long time since I wrote VB for a macro based tool. I'm trying to model the old language.

In the VB (macro)I added...

Dim destCell As Range
Dim NumOfCols As Long

Ran the pivot table and then...

With Worksheets("______")
Set destCell = .Cells(.Rows.Count, "A").End(xlUp).Offset(0, 0)
NumOfCols = .AutoFilter.Range.Columns.Count
End With
With destCell
.Offset(1, 0).Value = "Count Events"
End With
With destCell
.Offset(1, 2).Resize(1, NumOfCols - 2).FormulaR1C1 _
= "=SUBTOTAL(9,R5C:R[-3]C)"

Now I want to Count instead of Subtotal.

I don't know which row I will end up on with the pivoted data.
The "Count Events" works. The name of that row does show up in the first cell after the "Grand Total".

Now I want to count the column from the bottom starting from the first cell before the "Grand Total" to the beginning of the column. Any ideas?

When I record the macro I get: "=COUNT(R[-47]C:R[-1]C)" I don't want the count to begin in -47. I want it to start in the first 2 column of the last row offset by one and then fill the same formula for how any many columns of data there are.

Sorry. As you can see, I'm marginal at best in explaining what I'm trying to do...

VOL EE
DATE AS AC AT BK BM
2/9
2/11 1
2/12 -1
2/13 -2
2/14
2/15 -2 -50
2/18
2/19 -1
2/20 -5
2/21
2/22 -4
2/23 1
Total 1 -32 0 -51 -1
CntEvnt 1 5 0 2 1
 
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
Pivot table "Sum of" or "Count of" Scott Excel Programming 1 January 27th 10 09:49 PM
Create Pivot Table Data with Column "Sum" rather than "count" defa Johnny_99[_2_] Excel Discussion (Misc queries) 2 January 2nd 10 03:25 PM
Pivot tables - how do I change default from "count of" to "sum of" Cathy H Excel Worksheet Functions 2 November 19th 08 01:31 AM
"Dynamic" calculated fields in a pivot table csdjj Excel Discussion (Misc queries) 0 April 15th 08 05:21 PM
Pivot table "Group and Show Details" vs. "SubTotals" pgchop Excel Programming 0 February 1st 06 07:29 AM


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