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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top