View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
scottwilsonx[_53_] scottwilsonx[_53_] is offline
external usenet poster
 
Posts: 1
Default (Follow-up to earlier sort question) Further help required


Hello all:

Here is my VBA:

Sub SORT()
Dim SortMonth As Date
SortMonth = Range("B2").Value
Range("B6:Z36").Select
Selection.SORT Key1:=Columns(SortMonth), Order1:=xlAscending
End Sub

Where the value of B2 is dependent upon a drop down list, but is alway
a date: eg: March 2003 is 01/03/2003. And B6:Z36 is the range I want t
sort.
In C2 there is a lookup against the contents of B2 and this allocates
reference to each month in the validation list. eg: April 2003 is C
where C is the column that April 2003 is located in the spreadsheet.

What I would like is: for everytime the user changes the month in B2
they can then resort the data and the Selection.Sor
Key1:=Columns(SortMonth), will tell Excel what column to look at.

Thanks for any help

--
scottwilson
-----------------------------------------------------------------------
scottwilsonx's Profile: http://www.excelforum.com/member.php...fo&userid=1112
View this thread: http://www.excelforum.com/showthread.php?threadid=26646