Morning Guys,
I should probably credit you guys for most of the clever stuff behind a project I'm working on...
I have the below code that sorts a list of Doors that I have in row C17 downwards. Door 54, Door 7, Door 109 etc. The list is feeding a drop down box, so I needed this to help people find the door they were looking for, in the said drop down box.
I wondered if there was some code I could add to the end of this, that would the sort worksheets, which are all named after each cell in the list, in the same order.
I should probably credit you guys for most of the clever stuff behind a project I'm working on...
I have the below code that sorts a list of Doors that I have in row C17 downwards. Door 54, Door 7, Door 109 etc. The list is feeding a drop down box, so I needed this to help people find the door they were looking for, in the said drop down box.
Code:
Sub ListSorter()
Dim LastRow As Long
LastRow = Range("C" & Rows.Count).End(xlUp).row
Range("F17").Copy Range("D17")
Application.CutCopyMode = False
Range("D17").AutoFill Destination:=Range("D17:D" & LastRow)
ActiveWorkbook.Worksheets("Home").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Home").Sort.SortFields.Add Key:=Range("D17:D" & LastRow) _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortTextAsNumbers
With ActiveWorkbook.Worksheets("Home").Sort
.SetRange Range("C17:D" & LastRow)
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("D17:D" & LastRow).Select
Selection.ClearContents
End Sub
I wondered if there was some code I could add to the end of this, that would the sort worksheets, which are all named after each cell in the list, in the same order.