Results 1 to 3 of 3
  1. #1
    martin taylor
    Guest

    UNDO AN ACTION IN VBA

    I have a report on Excel, but the user wants to sort it into a slightly different order, then print , and then undo the sort. I wish to do this by providing a macro button. However VBA cannot undo the sort command if it has been actioned within the macro. Is there any method of doing this ?

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: UNDO AN ACTION IN VBA

    I would copy the data and then paste it into a new sheet and do the sorting and work there, then delete the sheet when I was done.
    Legare Coleman

  3. #3
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: UNDO AN ACTION IN VBA

    It is always a good idea to retain the original order of data, and an easy way to do it is insert an additional column before any sort is done. You can then fill the column with the formula = ROW(). When it is complete, copy the new column and then Paste Special, Value over itself. You can then sort the data at any time on that column to restore the original order.

    Andrew C

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •