Thread: Combo Box
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy[_2_] Patrick Molloy[_2_] is offline
external usenet poster
 
Posts: 1,298
Default Combo Box

you're correct
use

dim colClient as long
colClient = 7 ' 7=G

Key1:=Cells(9,colClient)

you could easily use say the MATCH() function to determine what column to use
eg
colClient = worksheet.functions.Match(what,Range("A9:L9"),Fals e)

HTH
Patrick

"teresa" wrote:

Sub SOR()
I have a combobox - when I choose an option it arranges data according to
Client which is currently in column G, however I need to sort data according
to "Client" irrespective of the Column, how do I tinker with the code below
to do this - Thanks

The bit I think I need changing is Key1:=Range("G9")
to
Range("col("Client")9) or something like this


Range("C9:AS69").Select
Selection.Sort Key1:=Range("G9"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub