ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sort data from smallest to largest (https://www.excelbanter.com/excel-programming/437053-sort-data-smallest-largest.html)

Mary Pencey

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?

Otto Moehrbach[_2_]

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?




All times are GMT +1. The time now is 11:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com