T
Todd Huttenstine\(Remote\)
I have the following working code to sort the range of data by the value in
combobox1.
Using the following code, what adjustments do I need to make to get it to
sort all the data by Ext?
Private Sub CommandButton2_Click()
'Sorts by the stat you select in the combobox.
'Sorts all data in the range A4:Z100
Dim Rng As Range, rng1 As Range
Dim res As Variant
Dim rng2 As Range
With Worksheets(1)
Set Rng = .Range("A4:Z100")
Set rng1 = .Range("A4:Z4")
End With
res = Application.Match(ComboBox1.Value, rng1, 0)
If Not IsError(res) Then
Set rng2 = rng1(1, res)
Rng.Sort Key1:=rng2, Order1:=xlAscending, _
Header:=xlYes, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom
End If
Unload Me
End Sub
Thanx
Todd Huttenstine
combobox1.
Using the following code, what adjustments do I need to make to get it to
sort all the data by Ext?
Private Sub CommandButton2_Click()
'Sorts by the stat you select in the combobox.
'Sorts all data in the range A4:Z100
Dim Rng As Range, rng1 As Range
Dim res As Variant
Dim rng2 As Range
With Worksheets(1)
Set Rng = .Range("A4:Z100")
Set rng1 = .Range("A4:Z4")
End With
res = Application.Match(ComboBox1.Value, rng1, 0)
If Not IsError(res) Then
Set rng2 = rng1(1, res)
Rng.Sort Key1:=rng2, Order1:=xlAscending, _
Header:=xlYes, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom
End If
Unload Me
End Sub
Thanx
Todd Huttenstine