The following routine will sort the sheets in a workbook alphabetically. The flag “Sort_Mode_Descending” can be switched between descending and ascending as required. The routine is case INSENSITIVE.
Sub Sort_Sheets()
Dim Sort_Mode_Descending As Boolean
Dim No_of_Sheets As Integer
Dim Outer_Loop As Integer
Dim Inner_Loop As Integer
No_of_Sheets = Sheets.Count
‘Change Flag As appropriate
Sort_Mode_Descending = False
For Outer_Loop = 1 To No_of_Sheets
[...]
Recommended Links:
The standard Excel “Column” Function returns the number rather than the letter of the column e.g:
Column(E4) – returns the number 5 rather than the letter E
Column(AD12) returns the number 30 rather than AD.
The following function returns the letter rather than the number of the column. So in the above two examples we have the letters [...]
The following function will extract the numerical portion from a string:
Function Extract_Number_from_Text(Phrase As String) As Double
Dim Length_of_String As Integer
Dim Current_Pos As Integer
Dim Temp As String
Length_of_String = Len(Phrase)
Temp = “”
For Current_Pos = 1 To Length_of_String
If (Mid(Phrase, Current_Pos, 1) = “-”) Then
Temp = Temp & Mid(Phrase, Current_Pos, 1)
End If
If (Mid(Phrase, Current_Pos, 1) = “.”) Then
[...]