Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sort data from smallest to largest

I need to sort data in Column A in numerical order from smallest to
largest, and that is correct for any number of rows. So this macro
could be run on a column that has data on rows 3-200, or on rows
3-500.

Does anyone know how to write code in VBA for this in excel 2007?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Sort data from smallest to largest

Mary
This little macro will sort column A from A2 down to the last entry in
that column. I assumed you have headers in row 1. HTH Otto
Sub SortColA()
Dim rColA As Range
Set rColA = Range("A2", Range("A" & Rows.Count).End(xlUp))
rColA.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub

"Mary Pencey" wrote in message
...
I need to sort data in Column A in numerical order from smallest to
largest, and that is correct for any number of rows. So this macro
could be run on a column that has data on rows 3-200, or on rows
3-500.

Does anyone know how to write code in VBA for this in excel 2007?


Reply
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
smallest to largest Mike Excel Discussion (Misc queries) 9 January 2nd 10 11:01 PM
Smallest to Largest JJ Excel Worksheet Functions 2 January 2nd 10 02:16 AM
Find Smallest and Largest. dlbeiler Excel Worksheet Functions 5 October 10th 07 02:16 PM
functions largest to smallest Sevengails Excel Worksheet Functions 2 January 3rd 07 09:37 AM
COMPARE DATA AND LIST SMALLEST AND LARGEST ENTRY BY UNIT Dwain A, louisiana Excel Discussion (Misc queries) 3 August 5th 05 05:01 PM


All times are GMT +1. The time now is 08:28 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"