get subtotals results as a variable

  • Thread starter Przemek =?iso-8859-2?Q?Wrzesi=F1ski?=
  • Start date
P

Przemek =?iso-8859-2?Q?Wrzesi=F1ski?=

Hi, every month I've got spreadsheet with payments (thousands of rows).
Usually I'm using subtotals to get sums grouped by currency. I know how to
write code in VBA for subtotals, but how can I get the results for
subtotals eg. as a variable? Number of payments is different every month,
so I can't used hard references to cells.
Or is it possible to name (named range) cells with subtotals results?
 
G

Guest

How many currencies do you have to subtotal and how many columns are you
subtotaling?
 
P

Przemek =?iso-8859-2?Q?Wrzesi=F1ski?=

Piêknego dnia, a by³ to 7 sierpieñ (niedziela) 2005, osobnik ukrywaj±cy siê
pod pseudonimem David w wiadomo¶ci
How many currencies do you have to subtotal and how many columns are you
subtotaling?

I've got 3 currencies and I'm subtotaling only one column (amount).
 
G

Guest

Hi,
This may do it for you.
Sub Macro1()
Range("A1").Select
Cells.Find(What:="* Total", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Currency1 = ActiveCell.Offset(0, 1).Value
Cells.FindNext(After:=ActiveCell).Activate
Currency2 = ActiveCell.Offset(0, 1).Value
Cells.FindNext(After:=ActiveCell).Activate
Currency3 = ActiveCell.Offset(0, 1).Value
End Sub
 
P

Przemek =?iso-8859-2?Q?Wrzesi=F1ski?=

Piêknego dnia, a by³ to 7 sierpieñ (niedziela) 2005, osobnik ukrywaj±cy siê
pod pseudonimem David w wiadomo¶ci
<napisa³/a:
[cut macro]

Thanks a lot, it works :)
 

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

Top