View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.misc
Caeres Caeres is offline
external usenet poster
 
Posts: 15
Default How do I use the .Cells property to refer to ActiveCell?

Had a few problems with your code, but you answered my question. I was
inputting the key value wrong. Thanks for the help.

"TomPl" wrote:

I'm not sure the point to all of this, but the following should do what you
have described. This will sort the data in columns A thru N based on the
value in column A. Only rows 4 thru the row of the active cell will be
sorted.

Sub SortSelection()

Dim rngCell As String

rngCell = ActiveCell.Row

ActiveSheet.Range("A3:N" & rngCell).Sort Key1:=Range("a4"),
Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
ActiveSheet.Range("A" & rngCell).Select

End Sub

Hope'n this works.

Tom