Sum column with errors, Macro

  • Thread starter Thread starter Danny
  • Start date Start date
D

Danny

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.
 
sub testsumif
Range("B1").Formula = "=SUMIF(A1:A" & _
Cells(Rows.Count, 1).End(xlUp).Row & ","" < ""&99^99)"
end sub
 
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
 

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

Back
Top