Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default Sort sheets using both alpha and numeric?

I need a function that I can call to sort sheets in ascending order left to
right, but NOT using DOS logic. I need conventional sort order. For example,
the following sheet names would be sorted as follows using a regular sort
routine:

1 Sheet
2 Sheet
20 Sheet
200 Sheet
3 Sheet
Sheet 6
Sheet 60
Sheet 700
Sheet 8

I need them sorted alpha and numeric; numbers may be at the beginning,
middle or end of the sheet name. Can someone please help by posting a
function that will handle this? Thanks much in advance.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Sort sheets using both alpha and numeric?

You will need to do a sort of some kind in code. Try goggle for bubble sort
or quick sort.

To get a list of sheets in to an array here is some code:

Sub Temp()

Dim aSheets() As String '*** Array to store sheet names
Dim sht As Worksheet, iLoop As Integer

ReDim aSheets(1 To ThisWorkbook.Sheets.Count)
iLoop = 1

'*** Loop thru each sheet and store the name
For Each sht In ThisWorkbook.Worksheets
aSheets(iLoop) = sht.Name

iLoop = iLoop + 1
Next sht

'*** Do bubble sort or quick sort on the array

Set sht = Nothing

End Sub


Regards,

Stewart


"quartz" wrote:

I need a function that I can call to sort sheets in ascending order left to
right, but NOT using DOS logic. I need conventional sort order. For example,
the following sheet names would be sorted as follows using a regular sort
routine:

1 Sheet
2 Sheet
20 Sheet
200 Sheet
3 Sheet
Sheet 6
Sheet 60
Sheet 700
Sheet 8

I need them sorted alpha and numeric; numbers may be at the beginning,
middle or end of the sheet name. Can someone please help by posting a
function that will handle this? Thanks much in advance.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Sort sheets using both alpha and numeric?

I have two ways to sort sheets...

"Numeric"
1 Sheet, 2 Sheet, 3 Sheet , 20 sheet, 200 Sheet, Sheet 6, Sheet 8, Sheet 60, Sheet 700

"Conventional?"
1 Sheet, 2 Sheet, 20 sheet, 200 Sheet, 3 Sheet, Sheet 6, Sheet 60, Sheet 700, Sheet 8

The sheet sorting is part of my Excel add-in "XL Extras".
It is accomplished by clicking on a pop-up menu item.

The updated version of the add-in, which includes several additional features,
will be available shortly - release 1.15
Available - free - upon direct request, remove XXX from my email address.

Jim Cone
San Francisco, USA
XX

"quartz" wrote in message
...
I need a function that I can call to sort sheets in ascending order left to
right, but NOT using DOS logic. I need conventional sort order. For example,
the following sheet names would be sorted as follows using a regular sort
routine:

1 Sheet
2 Sheet
20 Sheet
200 Sheet
3 Sheet
Sheet 6
Sheet 60
Sheet 700
Sheet 8
I need them sorted alpha and numeric; numbers may be at the beginning,
middle or end of the sheet name. Can someone please help by posting a
function that will handle this? Thanks much in advance.


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
Updating workbook with an alpha sort sheet and a numeric sort shee cjlatta Excel Discussion (Misc queries) 2 January 28th 09 12:00 AM
sort non delimeted non fixed width alpha numeric column jwbuyer Excel Discussion (Misc queries) 2 December 3rd 08 05:40 PM
if able, how do you sort Tabs in excel (alpha-numeric) ?? Dgadgetk Excel Worksheet Functions 3 November 10th 08 08:51 PM
Alpha Numeric Sort Cptn_Jon Excel Discussion (Misc queries) 1 December 1st 06 04:14 PM
Can I change the sort order to Alpha before Numeric? gracy Excel Discussion (Misc queries) 2 May 19th 06 09:16 PM


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