ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Sum column with errors, Macro (https://www.excelbanter.com/excel-worksheet-functions/182466-sum-column-errors-macro.html)

Danny

Sum column with errors, Macro
 
Hi,

I got this great formula from this NG.

=SUMIF(A1:A10,"<"&99^99)

I request for a macro to make the range A1:A10 variable
so it can sum the range where the active cell is.


Thank you.


Mike

Sum column with errors, Macro
 
sub testsumif
Range("B1").Formula = "=SUMIF(A1:A" & _
Cells(Rows.Count, 1).End(xlUp).Row & ","" < ""&99^99)"
end sub
"Danny" wrote:

Hi,

I got this great formula from this NG.

=SUMIF(A1:A10,"<"&99^99)

I request for a macro to make the range A1:A10 variable
so it can sum the range where the active cell is.


Thank you.


Danny

Sum column with errors, Macro
 
Hi Mike,

The macro you provided did not work.
The macro below that I also got from this NG sums where the active cell is.
The difference of the macro below and the one I'm requesting is, no matter
where the active cell is, the one I'm requesting will sum with text and/or
errors.

I tried to edit the macro below but was not able to. Please help.

Thank you.


Sub SumInActiveCell()
With ActiveCell
.Formula = "=SUM(" & _
Range(.Offset(-1, 0), _
.Offset(-1, 0).End(xlUp)).Address(False, False) & ")"
End With
End Sub


"Mike" wrote:

sub testsumif
Range("B1").Formula = "=SUMIF(A1:A" & _
Cells(Rows.Count, 1).End(xlUp).Row & ","" < ""&99^99)"
end sub
"Danny" wrote:

Hi,

I got this great formula from this NG.

=SUMIF(A1:A10,"<"&99^99)

I request for a macro to make the range A1:A10 variable
so it can sum the range where the active cell is.


Thank you.



All times are GMT +1. The time now is 03:25 AM.

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