View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Sorting Data in group

The code below sorts groups of Rows.
The code uses this line to perform the sort
If Range("A" & SubRowCount) < Range("A" & RowCount) Then
which is cell A of the first row of the group. If you want to use Column b
of the second row of the group then it would be
If Range("B" & (SubRowCount+1)) < Range("A" & (RowCount+1)) Then



Sub SortGroup()

GroupRows = 7
StartRow = 1

RowCount = StartRow
Do While Range("A" & RowCount) < ""
SubRowCount = RowCount + GroupRows
Do While Range("A" & SubRowCount) < ""
If Range("A" & SubRowCount) < Range("A" & RowCount) Then

Rows(SubRowCount & ":" & (GroupRows - 1)).Cut
Rows(RowCount).Insert Shift:=xlDown
End If
SubRowCount = SubRowCount + GroupRows
Loop
RowCount = RowCount + GroupRows
Loop

End Sub

"Akber Khan, Karachi, Pakistan" wrote:

Working on a excel sheet maintaining huge data and need to sort it date wise,
amount wise (range 1 to 10000, 10001 to 20000).

The problem is that we have data set of different clients, this data set of
each client spread over 9 columb and 7 rows and i need to sort it in a group.

How do i do this?
Data set should'nt be destroy?



for example
Columbs a

Name of Client nature of business funded non funded trade
business date of approval limit expiry date fresh/renewal remarks.

rows a
DM
MMF
IERF
BD/RISK LINE
PAD
OTHERS
SUBTOTAL