Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 274
Default Please help -Columns Array in SubTotals

Hi All,

I think this should be pretty straightforward but the answer is
eluding me. Its a Friday and l am tired!

I want to apply subtotals to a range using VBA the rub being that the
1st column for the subtotals is variable (say column 8 (H) in this
example) and the last column will always be +90 (98 in this example)

My idea was to find the 1st & last column number, create an array and
assign to an array variable to use in the subtotal function.

Please help, l am failing miserably!

Sample code ----- DOES NOT WORK

Sub SP_SubTotals()

Dim STArray(8 To 98) this to be replaced by LC(last column)

Sheets("Staff Planner").Activate
Range(Cells(4, 1), Cells(LR, LC)).Select
Selection.Subtotal GroupBy:=4, Function:=xlSum, TotalList:=(STArray),
_
Replace:=True, PageBreaks:=False, SummaryBelowData:=True

End Sub

TIA

Michael Beckinsale

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 - show all columns? Ben Excel Discussion (Misc queries) 2 April 16th 09 07:17 PM
Subtotals by Rows and Columns Nenad_S Excel Programming 0 June 1st 06 03:19 PM
Subtotals from multiple columns? grjk Excel Discussion (Misc queries) 1 February 3rd 06 03:18 PM
Subtotals multiple columns john liem Excel Worksheet Functions 0 July 6th 05 01:08 PM
Subtotals multiple columns john liem Excel Worksheet Functions 1 July 5th 05 06:06 PM


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