How can I rearrange worksheets?

T

trishk

I'd like to rearrange worksheets within a workbook so that they appear in
alphabetical order.
 
M

Mike H

Hi,

Right click a sheet tab, view code and paste this in 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
 

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