ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   sort a range (https://www.excelbanter.com/excel-programming/319872-sort-range.html)

Maileen[_2_]

sort a range
 
Hi,

I have a table where A1 and B1 contains respectively "Software" and
"Amount".
I would like to sort range (A2:B10) based on ascending sorting of Software.

I tried several things with range("A2:B10").Sort(Key1:=Range("A1")) but
nothing works...

could you help me please ?
thx,
Maileen

Frank Kabel

sort a range
 
Hi
try to record a macro whild applying your sort criteria manually

--
Regards
Frank Kabel
Frankfurt, Germany

Maileen wrote:
Hi,

I have a table where A1 and B1 contains respectively "Software" and
"Amount".
I would like to sort range (A2:B10) based on ascending sorting of
Software.
I tried several things with range("A2:B10").Sort(Key1:=Range("A1"))
but nothing works...

could you help me please ?
thx,
Maileen




Chip Pearson

sort a range
 
Maileen,

The key1 range must be in the range that is sorted. So, use
either

Range("A1:B10").Sort(Key1:=Range("A1")), Header:=True

or

Range("A2:B10").Sort(Key1:=Range("A2"))


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Maileen" wrote in message
...
Hi,

I have a table where A1 and B1 contains respectively "Software"
and "Amount".
I would like to sort range (A2:B10) based on ascending sorting
of Software.

I tried several things with
range("A2:B10").Sort(Key1:=Range("A1")) but nothing works...

could you help me please ?
thx,
Maileen





All times are GMT +1. The time now is 10:52 AM.

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