ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sorting a single column (https://www.excelbanter.com/excel-programming/333584-sorting-single-column.html)

Ken Loomis

Sorting a single column
 
In some VBA code, I need to sort column A on a hidden sheet called
"OldFiles". Column A is the only column containing data, so that is all that
needs to be sorted.

Can I do that without selecting that column.

and, either way, what VBA would I use?

It needs to be sorted alphabetically in ascending order.

TIA,
Ken




Jim Thomlinson[_4_]

Sorting a single column
 
Try something like this...

Sub SortColumn()
Dim rngToSort As Range

Set rngToSort = ActiveSheet.Range("A:A")

rngToSort.Sort Key1:=Range("A:A")

End Sub


--
HTH...

Jim Thomlinson


"Ken Loomis" wrote:

In some VBA code, I need to sort column A on a hidden sheet called
"OldFiles". Column A is the only column containing data, so that is all that
needs to be sorted.

Can I do that without selecting that column.

and, either way, what VBA would I use?

It needs to be sorted alphabetically in ascending order.

TIA,
Ken






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

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