i was tyring to write a code to sort the sheets in ascending order.
this is what i got but all it does is put all the sheets with which name starts by a 1 in front then put the other one in ascending order.
EG.
1, 10, 11, 2, 21, 22, 3, 4, 5, 6, 7, 8, 9
this is what i got but all it does is put all the sheets with which name starts by a 1 in front then put the other one in ascending order.
EG.
1, 10, 11, 2, 21, 22, 3, 4, 5, 6, 7, 8, 9
Code:
Dim i As Integer, j As Integer, h As Integerh = Sheets.CountOn Error GoTo ErrorTrap:For i = 1 To h - 1 For j = i + 1 To h If Sheets(j).Name < Sheets(i).Name Then Sheets(j).Move Before:=Sheets(i) End If Next NextErrorTrap: