ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   (Follow-up to earlier sort question) Further help required (https://www.excelbanter.com/excel-programming/312532-follow-up-earlier-sort-question-further-help-required.html)

scottwilsonx[_53_]

(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



All times are GMT +1. The time now is 10:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com