Rearrange sheets in excel

Hi,
I’m trying to rearrange multiple sheets in excel below is the code being used. But issue is after sheet 1; Sheet 10, Sheet 11… so on is arranged which is not correct please refer attached image.

Sub ArrangeSheets()
For i = 1 To Application.Sheets.Count
For j = 1 To Application.Sheets.Count - 1
If UCase$(Application.Sheets(j).Name) > Ucase$(Application.Sheets(j + 1).Name) Then
Sheets(j).Move after:=Sheets(j + 1)
End If
Next
Next
End Sub

Thanks,

Hi @vemuri

Try this

File1.txt (412 Bytes)

Output:

image

Regards,

Hi @lrtetala,

I’m able to rearrange upto sheet 9, but my issue is from sheet 10 which is not getting arranged as per the code.

Likewise I have to reorder for about 50 sheets.

Thanks

Hi @vemuri

Try the below code it is working

File1.txt (745 Bytes)

Cheers!!