PDA

View Full Version : how to put the sheets in order?



maryam
03-06-2007, 04:16 AM
when you open excel file, it has sheet1 sheet2 sheet3 in sequence
if you add sheet4 to the begining In VBA you see Sheet1(Sheet4)
now, it you move sheet4 to the 3rd position, still it is shown Sheet1(Sheet4). How to put the sheets in order now?

Bob Phillips
03-06-2007, 04:55 AM
See http://www.cpearson.com/excel/sortws.htm

maryam
03-06-2007, 06:05 PM
how to sort manually?

Bob Phillips
03-07-2007, 01:18 AM
Just drag them into place.

maryam
03-07-2007, 08:52 PM
based on post#1, I want sheet4 to be the third sheet, but if I drag it to the third position, it will still show me sheet1(sheet4). How to make it
sheet3(sheet4)?

Charlize
03-08-2007, 12:19 AM
From the link that xld gave you.Sub SortWS3()
Dim SortOrder As Variant
Dim Ndx As Long
SortOrder = Array("CSheet", "ASheet", "BSheet")
For Ndx = UBound(SortOrder) To LBound(SortOrder) Step -1
Worksheets(SortOrder(Ndx)).Move before:=Worksheets(1)
Next Ndx
End SubCharlize

Bob Phillips
03-08-2007, 01:25 AM
based on post#1, I want sheet4 to be the third sheet, but if I drag it to the third position, it will still show me sheet1(sheet4). How to make it
sheet3(sheet4)?

That is renaming, not sorting.