Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
jon jon is offline
external usenet poster
 
Posts: 18
Default sheet orderings

I want to automatically sort my sheets out in a workbook,
eg
sheet 1 is named "Msowdon - 101/1" - the first entry
sheet 2 "Msowdon - 101/4" - the fourth entry
sheet 3 "msowdon - 101/10" - the tenth entry
sheet 4 "Msowdon - 101/12" - the twelth entry

if i add a new sheet for the 11th job in this area the
sheet will be called "Msowdon - 101/11" and should come
after 101/10 and before 101/12, but after 101/4.

The reference 101/11 is found from an entry on the sheet,
and i can get excel to check the sheet reference and sort
the sheets back in to order. My problem is this...

Can I get excel to sort out in respect to the second
number, so 101/4 will come before 101/11?

I have tried changing the cells catagory in the format
section, and it's not possible to have a zero in front of
the 4 ie 101/04 as it is part of a much larger system.


if anyone has encountered this, or has any solutions i
would be eternally grateful.

TIA

Jon

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default sheet orderings

Not using built in sorting or comparison.

"101/10" is < "101/4"

? "101/10" < "101/4"
True


So you would have to sort by name, then for sheets with the same area, break
out the numbers after the / and re sort just the area based on that.

Or you could write similar type logic for the basic sort.

--
Regards,
Tom Ogilvy

"jon" wrote in message
...
I want to automatically sort my sheets out in a workbook,
eg
sheet 1 is named "Msowdon - 101/1" - the first entry
sheet 2 "Msowdon - 101/4" - the fourth entry
sheet 3 "msowdon - 101/10" - the tenth entry
sheet 4 "Msowdon - 101/12" - the twelth entry

if i add a new sheet for the 11th job in this area the
sheet will be called "Msowdon - 101/11" and should come
after 101/10 and before 101/12, but after 101/4.

The reference 101/11 is found from an entry on the sheet,
and i can get excel to check the sheet reference and sort
the sheets back in to order. My problem is this...

Can I get excel to sort out in respect to the second
number, so 101/4 will come before 101/11?

I have tried changing the cells catagory in the format
section, and it's not possible to have a zero in front of
the 4 ie 101/04 as it is part of a much larger system.


if anyone has encountered this, or has any solutions i
would be eternally grateful.

TIA

Jon



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default sheet orderings

jon wrote:

I want to automatically sort my sheets out in a workbook,
eg
sheet 1 is named "Msowdon - 101/1" - the first entry
sheet 2 "Msowdon - 101/4" - the fourth entry
sheet 3 "msowdon - 101/10" - the tenth entry
sheet 4 "Msowdon - 101/12" - the twelth entry

if i add a new sheet for the 11th job in this area the
sheet will be called "Msowdon - 101/11" and should come
after 101/10 and before 101/12, but after 101/4.

The reference 101/11 is found from an entry on the sheet,
and i can get excel to check the sheet reference and sort
the sheets back in to order. My problem is this...

Can I get excel to sort out in respect to the second
number, so 101/4 will come before 101/11?

I have tried changing the cells catagory in the format
section, and it's not possible to have a zero in front of
the 4 ie 101/04 as it is part of a much larger system.


if anyone has encountered this, or has any solutions i
would be eternally grateful.

TIA

Jon


Read this: http://www.cpearson.com/excel/sortws.htm

You will have to change the lines that read:

If UCase(Worksheets(N).Name) UCase(Worksheets(M).Name) Then

to something like this:

If val(mid(Worksheets(N).Name,4)) val(mid(Worksheets(M).Name,4) Then

The mid(...,4) is assuming the first part is always 4 chars long: "101/"
And the val(...) is assuming you are always using numbers in the second
part.

--
Amedee Van Gasse

To top-post is human, to bottom-post and snip is sublime.

Dit bericht is geplaatst in een nieuwsgroep. Post je evt antwoord of
vervolgvraag graag in dezelfde thread in de nieuwsgroep a.u.b.
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
excel sheet bootom half sheet goes behind top part of sheet rob Excel Worksheet Functions 2 January 17th 09 01:28 AM
Duplicate sheet, autonumber sheet, record data on another sheet des-sa[_2_] Excel Worksheet Functions 0 May 8th 08 06:56 PM
How do I select price from sheet.b where sheet.a part no = sheet.b Sonny Excel Worksheet Functions 4 April 4th 06 05:08 PM
relative sheet references ala sheet(-1)!B11 so I can copy a sheet. RonMc5 Excel Discussion (Misc queries) 9 February 3rd 05 12:51 AM
Inserting a row in sheet A should Insert a row in sheet B, removing a row in Sheet A should remove the corresponding row in sheet B Hannes Heckner Excel Programming 1 March 5th 04 09:10 AM


All times are GMT +1. The time now is 01:00 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"