Subtotaling within a Macro

H

hosmurf

Hi,

I'm writing my first macro, and I need some help. So I have my datase
selected> D1: the end of the data. I want to replicate the behavior o
the subtotal pop up (where it asks me "Add subtotal to" and then I ca
select each colum I want to see a subtotal for: Columns E1 through th
last column.

When I record the macro, I get this:

Selection.Subtotal GroupBy:=2, Function:=xlSum, TotalList:=Array(15
16, 17 _
, 18, 19, 20, 21, 22), Replace:=True, PageBreaks:=False
SummaryBelowData:= _
True

I think the "TotalList" Thing is messing me up. How do I select th
Array from, let's say Column E through the end of the data? the numbe
of columns is variable.

Darn it, this is not making sense... anyone understand what i'
saying?

Explaining problems in excel through text is really difficult.

Thanks for reading.
Jo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Subtotal by VBA 5
Subtotal Formatting 2
Subtotal function 2
Subtotals 2
Subtotal macro in each worksheet 13
Subtotal Macro Help 2
Issue with nested data subtotals 3
subtotal question 1

Top