Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
much smaller and quicker than mine. I'll use it from now on.
"Tom Ogilvy" wrote in message ... code is untested and may contain typos: Private Sub cmdOK_click() '< == OK Dim rng As Range, rng1 As Range Dim res As Variant Dim rng2 As Range With Worksheets("sheet1") Set rng = .Range("A6:U55") Set rng1 = .Range("A6:U6") 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 Private Sub Userform_Initialize Dim rng As Range With Worksheets("sheet1") Set rng = .Range("A6:U6") End With for each cell in rng Combobox1.AddItem cell.Value Next End With Private Sub cmdCancel_Click() Unload Me End Sub -- Regards, Tom Ogilvy Todd Huttenstine wrote in message ... Hey guys, I have a name in each cell from A6 through U6. The objective is to be able to sort by each of these names. I will use a form that will contain 3 objects: A DROP DOWN BOX, OK button, and CANCEL button. I need for each name in range A6:U6 to show up in the drop down box. I will select a name from the drop down box and click the OK button. When I click the OK button, I need it to sort data in range A7:U55 by the name I selected from the drop down box. Can anyone tell me the code? Thanx Todd Huttenstine |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Pivot Table Error Message - "Command Text not set for command obje | Excel Discussion (Misc queries) | |||
Why is the sort command in excel 2003 shaded out? | New Users to Excel | |||
Sort command does not sort some columns? | New Users to Excel | |||
how do i trace back my sort command on a column ????? | Charts and Charting in Excel | |||
sort command | New Users to Excel |