VBA Code:
Sub KDS() 'Fluff @MrExcel 9/24
Dim Dic As Object
Dim Ary As Variant
Dim ws As Worksheet
Set Dic = CreateObject("scripting.dictionary")
With ThisWorkbook
For Each ws In .Worksheets
Dic(ws.CodeName) = Empty
Next ws
End With
Ary = SortAZ(Dic)
AA04.Range("AH5").Resize(UBound(Ary) + 1).Value = Application.Transpose(Ary)
End Sub
VBA Code:
Function SortAZ(InDic As Object) As Variant
Dim Ary As Variant
Dim i As Long, j As Long
Dim Tmp As Variant
Ary = InDic.keys
For i = 0 To InDic.count - 2
For j = i + 1 To InDic.count - 1
If UCase(Ary(i)) > UCase(Ary(j)) Then
Tmp = Ary(j)
Ary(j) = Ary(i)
Ary(i) = Tmp
End If
Next j
Next i
SortAZ = Ary
End Function
Thanks to Fluff at MrExcel I got a list of the code.names in order for my worksheets in this workbook. This worked great for a few weeks. But now because of a design change for this workbook I need the worksheets name that corresponds to this list instead of code.names. This code is far above my level, so I need help. Instead of a organized list of code.names in AA04.Range("AH5"), I need a list of names in AA04.RANGE("AH5") that corresponds to that list.