Sorting rows beneath headlines in another sheet

I

Imbecill

I have 40 rows on sheet1 who are sorted by column D. The data in D column
can contain 4 different values - lets say "Alpha", "Beta", "Delta" and
"Gamma" and also be empty "" .

I have 4 different "areas" with headlines named "Alpha", "Beta", "Delta" and
"Gamma" with 20 rows under each headline in sheet2. The rows from sheet1
should be copy-pasted (or "mirrored" if no loops) out to each and don't
considered/cared for the empty rows(= "" in cell D). If there is more than
20 rows of "Alpha", "Beta", "Delta" or "Gamma", it should be an error msgbox
telling "to many rows".

I prefere to do it without a loop approach if possible because of the time
consumtion. It should all start with a macro button in the sheet. I already
have a button to sort them in order, but that might not be necessary...

Extra: Actually, It isn't the whole row that should be pasted to sheet2,
just the cells in column A and B. I'm just embarrassed to put down the whole
problem in you lap...:)

Anybody with a helping hand? All suggestions, hints or code to deal with
parts of the problem are welcome. How to match and copy each row, how to
decide which row is free for the "next" line to be paste into etc.

I got Excel 2002 if that's matter.

/Regards
 
B

Bob Kilmer

The key is how to identify the members of the groups. For 40 rows, I
wouldn't knock myself out trying to find a non-interative approach. It will
run fast enough if you don't do something really lame. Just loop thru the 40
cells in column D, identify where they go, set the appropriate target values
equal to the source values and "remember" where the next one goes for each
case.

Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top