View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
scottwilsonx[_50_] scottwilsonx[_50_] is offline
external usenet poster
 
Posts: 1
Default Sorting based on a cell


Thanks to Tom who replied to my earlier email.
I have made some alterations, which are detailed below:

Data range from B5 to Z37 where row 5 is the header showing Apr-03 t
Mar-05 in C5 to Z5. and where column B contains the row headers.

My sort macro looks like this:

Sub SORT()
Dim SortMonth As Integer
Range("B2").Value = SortMonth
Range("B5:Z37").Select
Selection.SORT Key1:=Range(SortMonth), Order1:=xlAscending
End Sub

It isn't working properly. I have created a SortMonth dimension whic
is based on the value in cell B2. What I would like to do is where th
Selection.Sort looks for a range, I want it to look in B2 and take tha
value, which is equivalent to the months in C5 to Z5.

Thanks for your help.

Regards

Scott

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