LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default macro to re-order sheets based on cell value?

Here's some simple code

Dim i As Long
Dim fOrder As Boolean

Do
fOrder = True
For i = 1 To Worksheets.Count - 1
If Worksheets(i).Range("C1").Value _
Worksheets(i + 1).Range("C1").Value Then
Worksheets(i).Move after:=Worksheets(i + 1)
fOrder = False
End If
Next i
Loop Until fOrder



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"neowok " wrote in message
...
I have 22 sheets with dientical layouts in a workbook. what i need is a
macro fo some kind that will re-order the sheets in the workbook based
on the value in a particular cell (it will be the same cell in each of
the sheets).

Basicallly I have 3 sets of dates on these sheets and i need to be able
to order the sheets in the workbook based on which one of these dates
I need to sort by at the time (basically putting the earliest dates at
the front).

A macro that will sort the 22 sheets putting the earliest date in C1 at
the start would do. If i then need to order them by E1 instead then
I'll only have to change a tiny bit in the macro.

Thanks


---
Message posted from http://www.ExcelForum.com/



 
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
Macro to hide sheets based upon cell value Joe M. Excel Discussion (Misc queries) 3 January 13th 10 07:05 PM
change order of 5 letter word based on another cell containing 5 numbers Forum Freak[_2_] Excel Worksheet Functions 5 July 19th 08 08:39 PM
Hide sheets based on Cell value Mike Milmoe Excel Discussion (Misc queries) 4 January 16th 07 05:57 AM
Daily Macro to Download Data, Order and paste in order Iarla Excel Worksheet Functions 1 November 17th 04 01:59 PM
Unhide sheets based on a cell value Tim[_36_] Excel Programming 6 April 30th 04 02:57 AM


All times are GMT +1. The time now is 02:24 AM.

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"