gheyman
Well-known Member
- Joined
- Nov 14, 2005
- Messages
- 2,341
- Office Version
- 365
- Platform
- Windows
I know that this code is creating a list of all the tab names and listing them starting in Row 16 column A
I see that it is supposed to sort the list. But what is line of code below doing? Why ("A6:A9")? What is this line doing or its purpose
ActiveWorkbook.Worksheets("Archive").Sort.SortFields.Add Key:=Range("A6:A9"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Archive").Sort
Thanks for the help
I see that it is supposed to sort the list. But what is line of code below doing? Why ("A6:A9")? What is this line doing or its purpose
ActiveWorkbook.Worksheets("Archive").Sort.SortFields.Add Key:=Range("A6:A9"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Archive").Sort
Code:
Sub Create_Archive()
Dim i As Integer
For i = 1 To ThisWorkbook.Sheets.Count
Sheet15.Cells(i + 15, 1) = Sheets(i).Name
Next i
'Sort the Tab Names
Sheet15.Range("A16:A665").Select
ActiveWorkbook.Worksheets("Archive").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Archive").Sort.SortFields.Add Key:=Range("A6:A9"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Archive").Sort
.SetRange Range("A16:A665")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
Thanks for the help