please help...

  • Thread starter Thread starter debra2468
  • Start date Start date
D

debra2468

hi all,
i am looking out for a macro code which can sort a column in ascendin
order..
i have a column K which contains positive and negative values..i nee
to sort this column in ascending order..then i have to display th
grand totals of the positive and negative values by inserting rows an
bold these totals....

can someone please help me out in this
 
Debra,

Not sure where you want the sums, so I put them at the top of column J for
now:

Sub Macro2()

Columns("K:K").Sort Key1:=Range("K1"), _
Order1:=xlAscending, Header:=xlGuess 'change to xlYes or xlNo, as
appropriate
Range("J1").Formula = _
"=""The Sum of the Positive #s is "" & SUMIF(K:K,"">0"")"
Range("J2").Formula = _
"=""The Sum of the Negative #s is "" & SUMIF(K:K,""<0"")"
Range("J1:J2").Font.Bold = True
End Sub

HTH,
Bernie
MS Excel MVP
 

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