View Full Version : Grouping Multiple Levels of Data

08-04-2006, 02:12 PM
Hi, I would like to start off by saying how great these forums are and how much i've learned in just the past hour reading though them. I haven't done VB in 5 years and I have a task that requires either some programming or countless hours of manual work. On to my question:

I hav e attached a small portion of the spreadsheet. the order of #'s is irrelevant to the grouping.

What I need to do is group all the 3rd level ranges first and then next the 2nd levels. My idea for coding was as follows:
'find beginning C cell (2nd level)
'-GROUPING D CELLS (3rd level)-
'begin by selecting a non-empty D cell
'select a range of D cells until an empty D cell is found
'group that range then check if the cell in the same row and to the left of the D cell is empty (making it a 2nd level cell or C cell)
'if cell to left of empty D cell is not empty add that to range of C cells to group
'continue on until there is no C cell and group the range starting with a beginning C cell and the last one

If anyone can help me out in doing this I would greatly appreciate it and I thank you in advance for taking the time to look at my code.

Thanks again,