try this
Range("K2").Select
Selection.Sort Key1:=Range("K1"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
Set item1 = Range("K2")
Do While Not IsEmpty(item1)
Set item2 = item1.Offset(1, 0)
If item1 < 0 Then
Set item1 = item2
Else
item1.EntireRow.Insert
item1.EntireRow.Insert
Exit Do
End If
Loop
Range("K2").End(xlDown).Offset(1, 0).Select
With ActiveCell
Set Rng = Range(.Offset(-1, 0), .Offset(-1, 0).End
(xlUp))
.Formula = "=Sum(" & Rng.Address & ")"
End With
ActiveCell.Offset(2, 0).Select
ActiveCell.End(xlDown).Offset(1, 0).Select
With ActiveCell
Set Rng = Range(.Offset(-1, 0), .Offset(-1, 0).End
(xlUp))
.Formula = "=Sum(" & Rng.Address & ")"
End With
-----Original Message-----
hi all,
i am looking out for a macro code which can sort a column
in ascending
order..
i have a column K which contains positive and negative
values..i need
to sort this column in ascending order..then i have to
display the
grand totals of the positive and negative values by
inserting rows and
bold these totals....
can someone please help me out in this ?
---
Message posted from http://www.ExcelForum.com/
.