Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 122
Default labels for subtotals

Hello:

I'm going to create an Excel macro that, among other things, subtotals a
column of numbers based on column B. Column B contains account numbers.
(So, the macro will sort by column B, first.)

I'd like for the row that shows the subtotal to have a distinct label. The
label essentially will come from column C. Column C contains the account
number description.

This subtotal label will make it easier for the end user to understand what
is being subtotaled.

Is it possible to program a subtotal "label" in Excel?

childofthe1980s
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default labels for subtotals

On Feb 21, 1:01*pm, childofthe1980s
wrote:
Hello:

I'm going to create an Excel macro that, among other things, subtotals a
column of numbers based on column B. *Column B contains account numbers.. *
(So, the macro will sort by column B, first.)

I'd like for the row that shows the subtotal to have a distinct label. *The
label essentially will come from column C. *Column C contains the account
number description.

This subtotal label will make it easier for the end user to understand what
is being subtotaled.

Is it possible to program a subtotal "label" in Excel?

childofthe1980s


The subtotal command automatically used the values in the selected
column, so perhaps this will do your desire? Obviously need to adjust
the range for your data.
It sorts the range by column(B) ascending, then subtotals the range
using a Sum function on column(C). Finally it auto-adjusts column(B)'s
width to accommodate the subtotal titles.

Sub test()
With Range("B3:C16")
.Sort Key1:=Range("B4"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,
_
DataOption1:=xlSortNormal
.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(2), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
End With
Columns("B:B").EntireColumn.AutoFit
End Sub
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
Can you change the text displayed on the labels a Pivot Tables'creates for subtotals? alan82 Excel Discussion (Misc queries) 0 December 11th 08 12:16 PM
Subtotals problem: Excel 2003 (not, AFAIK, the nested subtotals bug) AndyCotgreave Excel Discussion (Misc queries) 3 October 24th 07 11:32 AM
Copying Labels in Subtotals Instructor Cloud[_2_] Excel Discussion (Misc queries) 0 July 19th 07 08:22 PM
Subtotals: Nested subtotals below higher subtotal RobN Excel Discussion (Misc queries) 1 July 20th 06 09:04 PM
Problem with nested subtotals, placing secondary subtotals BELOW . Dawn Cameron Excel Discussion (Misc queries) 1 June 3rd 05 10:13 PM


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