View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
warren warren is offline
external usenet poster
 
Posts: 15
Default clearing excel memory before saving

Excel seems to hold onto its completed macro in the background. then saving
the file increases file size by 4.5 mb.

Can you code in a macro to run, then clear its memory. User can then save
file when ready without increasing the file size. The information only
sorts, no new data is added, but file increase 4.5 mb. You can run the marco
as many times as you like, file size does not continue to grow.

You can exit, reopen and re save and the file decrease by 4.5mb until the
marco is re run.

Many thanks if you can help - going mad trying to work it out

code im using is below

Code

Sheets("Team Data").Select
Range("A5:BK300").Select
Selection.Sort Key1:=Range("A5"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("A5").Select
Sheets("Input").Select
Range("C5:GF300").Select
Selection.Sort Key1:=Range("FI5"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom