I have a sheet called "End" that needs to be moved to be the last of all available sheets. I need to do this using VBA.
I have a sort routine that works, I just need the syntax for the move. Here is what I have:
Private Sub CommandButton263_Click()
Dim i As Integer
Dim j As Integer
For i = 1 To Sheets.Count
For j = 1 To Sheets.Count - 1
If UCase$(Sheets(j).Name) > UCase$(Sheets(j + 1).Name) Then
Sheets(j).Move After:=Sheets(j + 1)
End If
Next j
Next i
Sheets("Navigation").Select
Sheets("Navigation").Move Before:=Sheets(1)
Sheets("Navigation (2)").Select
Sheets("Navigation (2)").Move Before:=Sheets(2)
Sheets("EstimateTemplate").Select
Sheets("EstimateTemplate").Move Before:=Sheets(3)
Sheets("Formulas").Select
Sheets("Formulas").Move Before:=Sheets(4)
Sheets("End").Move After:=Sheets(EOF) 'what can i use instead of EOF?
Sheets("Navigation (2)").Select
End Sub
Specifically looking at line Sheets("End").Move After:=Sheets(EOF)
- What can I use to get the last sheet?
.Select
are superfluous