ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   get subtotals results as a variable (https://www.excelbanter.com/excel-programming/336621-get-subtotals-results-variable.html)

Przemek Wrzesinski

get subtotals results as a variable
 
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?

--
Przemek
Now playing: nothing

David

get subtotals results as a variable
 
How many currencies do you have to subtotal and how many columns are you
subtotaling?
--
David


"Przemek Wrzesiński" wrote:

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?

--
Przemek
Now playing: nothing


Przemek Wrzesinski

get subtotals results as a variable
 
Pięknego dnia, a był to 7 sierpień (niedziela) 2005, osobnik ukrywaj±cy się
pod pseudonimem David w wiadomo¶ci
napisał/a:
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).
--
Przemek
Now playing: nothing

David

get subtotals results as a variable
 
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
--
Thanks
David


"Przemek Wrzesiński" wrote:

Pięknego dnia, a był to 7 sierpień (niedziela) 2005, osobnik ukrywający się
pod pseudonimem David w wiadomości
napisał/a:
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).
--
Przemek
Now playing: nothing


Przemek Wrzesinski

get subtotals results as a variable
 
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 :)

--
Przemek
Now playing: "Metallica - Orion"


All times are GMT +1. The time now is 10:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com