Column Sort

  • Thread starter Thread starter Shaz
  • Start date Start date
S

Shaz

Hello
I have a table of data.
I would like to sort a column using a macro however the column is
determined by the cell selected. Is this possible.

Shazz
 
Shazz

If the table is contiguous from cell A1 the code below will work

Sub SortBySelected()
Range("A1").CurrentRegion.Sort Key1:=Range(ActiveCell.Address), _
Order1:=xlAscending, Header:=xlGuess
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
 
Back
Top