LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Group and ungroup

Hi all
I have a spreadsheet which has a list of data that was previously
grouped via the group and ungroup excel function.
I have removed this and want to concatenate data within the old
groups. As an example the data is like so.....

A
B
C
D
E
F
G
H
I
J
K

What i want to achieve is to group in cell A1 - A,B,C and then in A2 -
D,E,F and then in A3 - G,H,I,J,K

My code so far is below which allows me to group the first level but i
need to to take into account the second example of G,H,I,J,K which
covers more than two or three concatenations.

Can anyone help
Thanks very much


=====================
Dim fCell As Excel.Range
Dim sCell As Excel.Range

i = 0
r = 0

With ThisWorkbook.Sheets(1).Cells
Set fCell = .Range("A6")
Set sCell = .Range("C6")

With ThisWorkbook.Sheets(1).UsedRange
lLastRow = .Row + .Rows.Count - 1
End With

Do Until i = lLastRow
If iPrev = fCell.Offset(i, 0).Value Then
If sCell.Offset(i + 1, 0).Value < "" Then
Do While fCell.Offset(i, 0).Value
= ""
If iDesc = sCell.Offset(i,
0).Value Then
If sCell.Offset(r,
2).Value < "" Then
Do Until
sCell.Offset(r, 2).Value = ""
myval =
sCell.Offset(r, 2).Value
r = r + 1
i = i + 1
Loop
End If
Else

End If
iDesc = sCell.Offset(i, 0).Value
i = i + 1
r = r + 1
Loop
End If

Else

End If
iPrev = fCell.Offset(i, 0).Value
r = r + 1
Loop

End With

End Sub
============================

 
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
Ungroup and Group - Faded out SHIPP Excel Discussion (Misc queries) 0 May 19th 09 07:16 PM
Data Group and Ungroup Rebecca Excel Discussion (Misc queries) 3 January 3rd 09 09:13 AM
group&ungroup fofomama Charts and Charting in Excel 0 August 23rd 07 04:22 PM
group/ungroup meg99 Excel Programming 1 August 16th 07 04:08 PM
Help with Group/Ungroup deacs Excel Discussion (Misc queries) 3 January 30th 06 04:29 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"