#1   Report Post  
Posted to microsoft.public.excel.misc
Lp12
 
Posts: n/a
Default Sorting sheets

Hi All,
I have a workbook with several sheets. Each sheet is named by an employee ID
number. I want to sort the sheets according to the position of each group of
employee.
Is there a way to sort sheets? (A-Z or customize)
Thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.misc
Ardus Petus
 
Posts: n/a
Default Sorting sheets

Sub sortsheets()
'Re-Sort sheet names
' Thanks to McRitchie & Bill Manville
Dim iSheet As Integer
Dim iBefore As Integer

For iSheet = 1 To Worksheets.Count
For iBefore = 1 To iSheet - 1
If UCase(Sheets(iBefore).Name) UCase(Sheets(iSheet).Name) Then
Sheets(iSheet).Move befo=Sheets(iBefore)
Exit For
End If
Next iBefore
Next iSheet
End Sub

HTH
--
AP

"Lp12" a écrit dans le message de news:
...
Hi All,
I have a workbook with several sheets. Each sheet is named by an employee
ID
number. I want to sort the sheets according to the position of each group
of
employee.
Is there a way to sort sheets? (A-Z or customize)
Thanks in advance



  #3   Report Post  
Posted to microsoft.public.excel.misc
Ardus Petus
 
Posts: n/a
Default Sorting sheets

That was an alpha sort.
For a numeric sort:

'-------------------------------------------------------------------------------
Sub sortsheets()
'Re-Sort sheet names
' Thanks to McRitchie & Bill Manville
Dim iSheet As Integer
Dim iBefore As Integer

For iSheet = 1 To Worksheets.Count
For iBefore = 1 To iSheet - 1
If CInt(Sheets(iBefore).Name) CInt(Sheets(iSheet).Name) Then
Sheets(iSheet).Move befo=Sheets(iBefore)
Exit For
End If
Next iBefore
Next iSheet
End Sub


  #4   Report Post  
Posted to microsoft.public.excel.misc
Chip Pearson
 
Posts: n/a
Default Sorting sheets

You need to use a VBA procedure. See
www.cpearson.com/excel/sortws.htm for example code.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Lp12" wrote in message
...
Hi All,
I have a workbook with several sheets. Each sheet is named by
an employee ID
number. I want to sort the sheets according to the position of
each group of
employee.
Is there a way to sort sheets? (A-Z or customize)
Thanks 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
sorting master sheet messes up cells in other sheets linked to it Kt Excel Worksheet Functions 1 October 30th 05 12:25 PM
sorting master sheet messes up cells in other sheets linked to it Kt Excel Worksheet Functions 0 October 30th 05 10:36 AM
Sorting Data from 2 sheets, one sheet which is already sorted M. S. Excel Worksheet Functions 0 July 15th 05 06:42 PM
Linking sheets when sorting row and column data Sean 3DD Excel Worksheet Functions 0 January 5th 05 12:21 PM
Sorting Data to Different Sheets ccoverne Excel Worksheet Functions 1 November 10th 04 09:20 PM


All times are GMT +1. The time now is 08:12 AM.

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

About Us

"It's about Microsoft Excel"