how do i sort my excel worksheet in

M

Mike H

Hi,

Put this code in any worksheet module and run it

Sub Sortem()
For X = 1 To Worksheets.Count
For y = X To Worksheets.Count
If UCase(Sheets(y).Name) < UCase(Sheets(X).Name) Then
Sheets(y).Move Before:=Sheets(X)
End If
Next
Next
End Sub

Mike
 
M

Mike H

Ignore, I misread your post

Mike H said:
Hi,

Put this code in any worksheet module and run it

Sub Sortem()
For X = 1 To Worksheets.Count
For y = X To Worksheets.Count
If UCase(Sheets(y).Name) < UCase(Sheets(X).Name) Then
Sheets(y).Move Before:=Sheets(X)
End If
Next
Next
End Sub

Mike
 
B

BEOPS

I have posted a question on the same issue, and as I can't find it in the
forum, let me come in here. I am sorting 2 columnes according to the
instructions given in your link. However the second columne is sorted in kind
of groups. First come a-words, then some d-words, then some a-words again
(and so on). What could be the reason for this strange behaviour on the
second columne?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top