ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Subtotal use macro to Sumif (https://www.excelbanter.com/excel-programming/453704-subtotal-use-macro-sumif.html)

[email protected]

Subtotal use macro to Sumif
 
Hi,

I have a basic macro to run the subtotal in Excel, but I need to use a "SUMIF" instead of the "SUM" function.

I need to SUMIF the numbers in cells if they are greater than 0.01, or SUMs only the positive numbers and leave the negative out.


Sub Subtotal()
'
' Subtotal Macro
'
'
Range("A1").Select
Selection.Subtotal GroupBy:=5, Function:=xlSum, TotalList:=Array(25, 26, 27 _
, 28, 53, 54, 57, 58, 59, 68, 69, 77, 78, 86, 87, 95, 96, 104, 105, 113, 114, 122, 123, 132, 133, 141, _
142, 150, 151, 159, 160), Replace:=True, PageBreaks:=False, SummaryBelowData:= _
True
End Sub


Thanks
Marc


All times are GMT +1. The time now is 10:28 PM.

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