View Single Post
  #5   Report Post  
AQJH2 AQJH2 is offline
Junior Member
 
Posts: 1
Default

Thanks for the help, Roger. I have a slightly different question: Is there a way of doing the same thing with numerical data? What would have to be changed in the macro to allow this command to work on a datasheet with numbers (and is there a limit to the number of columns that can be independently sorted in this way?)

Quote:
Originally Posted by curtc.[_2_] View Post
Thanks Roger. It works great for sorting multi columns on the same sheet, but
yet independently. Curt

"Roger Govier" wrote:

Hi Curt

try the following macro

Sub SortColsIndependently()
Dim i As Long, lc As Long
lc = Cells(1, Columns.Count).End(xlToLeft).Column
For i = 1 To lc
Columns(i).Sort Key1:=Cells(1, i), Order1:=xlAscending
Next i
End Sub

Copy the Code above
Alt+F11 to invoke the VB Editor
InsertModule
Paste code into white pane that appears
Alt+F11 to return to Excel

To use
Alt+F8 to bring up Macros
Highlight the macro name
Run

--
Regards
Roger Govier

"curtc." wrote in message
...