Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Sorting question-is this possible

I would like to write code sorting the entire spreadsheet, excluding headers,
by first sorting column I to put all topics together in descending order and
then adding an empty row at the end of each topic to separate them. My
topics are just 3 values and they are

Stationary
Posters
Books

Then my next sort is to isolate each topic and sort each topic individually
by column D ascending. Col D is a currency value.

The end result would be each topic in column I would be sorted by ascending
dollar value in Col D

This spreadsheet is updated each day so the row count is unknown. Is this
even possible?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default Sorting question-is this possible

Hi Jouioui,

This might be one way to do it. I've done limited testing, but it
seems to work Ok.

Just add your updated rows at the bottom of the list then run this
macro.

Sub SrtCat()

Dim rng As Range, x As Integer

Set rng = ActiveSheet.UsedRange

rng.Sort Key1:=Range("A1"), Order1:=xlAscending, Key2:=Range("D1")
_
, Order2:=xlAscending, Header:=xlYes, OrderCustom:=1,
MatchCase:= _
False, Orientation:=xlTopToBottom

Set rng = Range(Cells(1, 1), Cells(Rows.Count, 1).End(xlUp))

For x = rng.Count To 3 Step -1
'rng(x).Select
If rng(x) < rng(x - 1) Then rng(x).EntireRow.Insert
(xlShiftDown)
Next x
End Sub

regards,

DaveU


On Mar 6, 9:36 am, JOUIOUI wrote:
I would like to write code sorting the entire spreadsheet, excluding headers,
by first sorting column I to put all topics together in descending order and
then adding an empty row at the end of each topic to separate them. My
topics are just 3 values and they are

Stationary
Posters
Books

Then my next sort is to isolate each topic and sort each topic individually
by column D ascending. Col D is a currency value.

The end result would be each topic in column I would be sorted by ascending
dollar value in Col D

This spreadsheet is updated each day so the row count is unknown. Is this
even possible?



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 question [email protected] Excel Worksheet Functions 3 February 13th 09 06:21 PM
sorting question kolonelvonklink Excel Discussion (Misc queries) 2 August 22nd 06 12:20 PM
Row sorting question jezzica85 Excel Discussion (Misc queries) 3 May 4th 06 11:13 PM
Sorting Question Tim Excel Discussion (Misc queries) 1 April 7th 05 04:57 PM
sorting question Brian Excel Worksheet Functions 5 November 30th 04 05:32 AM


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