Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Dena
 
Posts: n/a
Default Spreadsheet sorts when saved

I know there is a way to have a spreadsheet sort the information you add in
to it when you save the spreadsheet. However, I cannot find the path that
leads me to this option.

How do I do that?

  #2   Report Post  
Alan
 
Posts: n/a
Default

You need VB code. Copy and paste this into the VB editor, hit Alt and F11 to
open the VB editor, double click the 'This Workbook' icon on the top left,
copy and paste, hit Alt and F11 again to close the VB editor. Change the
sheet and cell references to suit and xlDescending to xlAscending if
required, watch out for text wrap in the e-mail, there should be three lines
of code.
Regards,
Alan.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Sheet1.Range("A1:A30").Sort Key1:=Sheet1.Range("A1"), Order1:=xlDescending
End Sub

"Dena" wrote in message
...
I know there is a way to have a spreadsheet sort the information you add in
to it when you save the spreadsheet. However, I cannot find the path that
leads me to this option.

How do I do that?



  #3   Report Post  
Dena
 
Posts: n/a
Default

Hi Alan,

I did as described below and then went into spreadsheet, added info, clicked
save and the info I added didn't sort into the rest of the spreadsheet.

What did I do wrong? Do I need additional info added to VB code?

Thanks

"Alan" wrote:

You need VB code. Copy and paste this into the VB editor, hit Alt and F11 to
open the VB editor, double click the 'This Workbook' icon on the top left,
copy and paste, hit Alt and F11 again to close the VB editor. Change the
sheet and cell references to suit and xlDescending to xlAscending if
required, watch out for text wrap in the e-mail, there should be three lines
of code.
Regards,
Alan.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Sheet1.Range("A1:A30").Sort Key1:=Sheet1.Range("A1"), Order1:=xlDescending
End Sub

"Dena" wrote in message
...
I know there is a way to have a spreadsheet sort the information you add in
to it when you save the spreadsheet. However, I cannot find the path that
leads me to this option.

How do I do that?




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Spreadsheet Sorts When Saved Dena Excel Discussion (Misc queries) 5 August 11th 05 04:46 PM
How do I display the last saved date in an EXCEL spreadsheet? Andrea Excel Discussion (Misc queries) 1 March 10th 05 08:55 PM
How can I retrieve a spreadsheet closed out of (not saved)? claudia Excel Worksheet Functions 1 February 26th 05 09:14 PM
How can I retrieve a spreadsheet closed out of (not saved)? Claudia Excel Worksheet Functions 0 February 26th 05 08:45 PM
Can I unsave a spreadsheet once it has been saved April_Presidion Excel Discussion (Misc queries) 1 December 3rd 04 06:58 PM


All times are GMT +1. The time now is 08:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"