Hi all,
I have this code from Leith Ross from a previous post for sorting ALL sheets alphabetically (which is great).
Sub AlphabetizeWorksheets()
Dim I As Long
Dim J As Long
Dim N As Long
Dim ShtNames()
N = Sheets.Count
ReDim ShtNames(N)
For I = 1 To N
ShtNames(I) = Sheets(I).Name
Next I
Application.ScreenUpdating = False
For I = 1 To N
For J = 1 To N - 1
If StrComp(ShtNames(I), ShtNames(J), vbTextCompare) = -1 Then
Sheets(I).Move Before:=Sheets(J)
End If
Next J
Next I
Application.ScreenUpdating = True
End Sub
I also have this code from vbaNoob for selecting only certain sheets
Sub SelectedSheets()
Dim i As Integer, flg As Boolean
For i = 1 To Sheets.Count
If Sheets(i).Name <> "Main" And Sheets(i).Name <> "View" And _
Sheets(i).Name <> "Annual" And Sheets(i).Name <> "Sick" Then
If Not flg Then
Sheets(i).Select
flg = True
Else
Sheets(i).Select False
End If
End If
Next
End Sub
Now what I'd like to do is to apply Leith's code to only the sheets selected by vbaNoob's code.
Can anyone point me in the right direction please. Any help, as always, gratefully received.
Thanks
Seamus
Bookmarks