Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Sorting a sheet in VBA

Hi

I seem to have problems with this - I have a sheet of 2 coloums as

A = string, B = number, given as =1+2+3+.....

Now, I want to sort by the number, therefo

sh2.Range("B:B").Sort Key1:=sh2.Range("B:B"), Order1:=xlAscending,
Orientation:=xlSortRows
sh2 = worksheet

However, that does not really work.... what do I do wrong?

WBR
Sonnich
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,549
Default Sorting a sheet in VBA

What does "does not really work" mean?
How is "sh2" established as a worksheet?

Do you do something like...
Dim sh2 as Worksheet
Set sh2 = Worksheets("Sludge")
--
Jim Cone
Portland, Oregon USA .
http://www.contextures.com/excel-sort-addin.html .
(editorial review of special sort excel add-in (30 ways to sort)




"Sonnich Jensen"

wrote in message
...
Hi

I seem to have problems with this - I have a sheet of 2 coloums as

A = string, B = number, given as =1+2+3+.....

Now, I want to sort by the number, therefo

sh2.Range("B:B").Sort Key1:=sh2.Range("B:B"), Order1:=xlAscending,
Orientation:=xlSortRows
sh2 = worksheet

However, that does not really work.... what do I do wrong?

WBR
Sonnich



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 420
Default Sorting a sheet in VBA

Maybe you want to sort both columns A and B???

sh2.range("a:b").sort .....



On 10/24/2011 10:22, Sonnich Jensen wrote:
Hi

I seem to have problems with this - I have a sheet of 2 coloums as

A = string, B = number, given as =1+2+3+.....

Now, I want to sort by the number, therefo

sh2.Range("B:B").Sort Key1:=sh2.Range("B:B"), Order1:=xlAscending,
Orientation:=xlSortRows
sh2 = worksheet

However, that does not really work.... what do I do wrong?

WBR
Sonnich


--
Dave Peterson
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
Sorting Data from a different sheet VoxBox-Richard Excel Worksheet Functions 1 November 4th 08 04:58 PM
Sorting sheet that contains lookups Amy Excel Discussion (Misc queries) 0 February 21st 08 08:46 PM
Sorting a sheet by VBA Farhad Excel Discussion (Misc queries) 2 September 5th 07 04:40 PM
SORTING TO ANOTHER SHEET cityfc Excel Discussion (Misc queries) 1 February 2nd 06 05:01 PM
Sorting a sheet JohnnyJomp Excel Worksheet Functions 3 May 30th 05 08:12 PM


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

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"