LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Column Sorting

Try recording a macro when you sort your range.

There's an option button on the sort dialog that allows you to specify right to
left.

I got this (in xl2002):

Range("C4:AN4").Select
Selection.Sort Key1:=Range("C4"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight, _
DataOption1:=xlSortNormal

I'd modify it to something like:

Option Explicit
Sub testme01()
Dim myRng As Range

Set myRng = Worksheets("sheet1").Range("c4:AN4")

With myRng
.Sort Key1:=.Cells(1), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
End With

End Sub

(you really meant sort by column???)



Todd Huttenstine wrote:

Ive got a worksheet with a table. On row 4 I have
different categorys. What is the code I would use for it
to look in Row 4 starting with column C and sort
alphabetical? My data goes from column C to Column AN in
row 4. I would like to have the code inserted into a
button so I can just click and it sort.

Thank you

Todd Huttenstine


--

Dave Peterson

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
sorting a column Googi Excel Worksheet Functions 2 March 14th 08 12:08 AM
Sorting a Pivot Table Column that is not the first column... [email protected] Excel Worksheet Functions 1 October 10th 07 09:02 PM
sorting by one column fst Excel Discussion (Misc queries) 1 February 21st 06 11:08 PM
How do I limit sorting a column to the column? Pat Excel Worksheet Functions 0 February 9th 06 04:01 PM
Right column doesn't change when sorting left column. nohope Excel Discussion (Misc queries) 2 July 19th 05 03:27 PM


All times are GMT +1. The time now is 12:53 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"