copy data in sheet1 in sheet2 also for retrieval
try this macro test
Sub test()
Dim r As Range
Application.DisplayAlerts = False
Set r = Range(Range("A1"), Cells(Rows.Count, "A").End(xlUp))
r.Sort key1:=Range("A1"), header:=xlYes
Set r = Range(Range("A1"), Cells(Rows.Count, "A").End(xlUp))
r.Subtotal GroupBy:=1, Function:=xlCount, TotalList:=Array(1), _
Replace:=True, PageBreaks:=False
Set r = Range(Range("B1"), Cells(Rows.Count, "B").End(xlUp))
r.SpecialCells(xlCellTypeFormulas, 1).Clear
r.RemoveSubtotal
Columns("A:A").Delete
Application.DisplayAlerts = True
End Sub
Sub undo()
Worksheets("sheet1").Cells.Clear
Worksheets("sheet2").Cells.Copy Worksheets("sheet1").Range("A1")
End Sub
Bookmarks