From: PVT on
Hello, I am trying to create a simple macro to compare two sorted
lists and move cells to be able to compare based on product number, by
keeping them together by class. Each product has three rows with data
that all need to be moved with it.

My thought was to shift cells down if the product numbers don't match
by row, since they will be sorted. However how to do this by class?

The raw data looks like this:

class product# totals class product# totals
1 240101 300 1 240101 302
$20000
$23000
$300 $301
1 240102 300 1 240103 500
$24000 $34000
$305 $401
1 240103 468 1 240104 200
$50000 $50500
$588 $599
1 240106 464 1 240108 455
$50900 $56888
$599 $533
2 240201 546 2 240202 555
$55985 $58499
$539 $578


The macro should make it look like this:
class product# totals class product# totals
1 240101 300 1 240101 302
$20000
$23000
$300 $301
1 240102 300
$34000

$401
1 240103 468 1 240103 500
$50000
$24000
$588
$305
1 240104 200
$50500
$599
1 240106 464
$50900
$599
1 240108 455

$56888

$533
2 240201 546
$55985
$539

2 240202 555

$58499
$578

Any help would be greatly appreciated!
From: PVT on
My text moved... let me correct:
>
> The raw data looks like this:
>
> class product# totals        class product# totals
> 1       240101   300           1       240101   302
>                       $20000 $23000
>                       $300                               $301
> 1       240102   300           1       240103  500
>                       $24000                           $34000
>                       $305                             $401
> 1       240103   468           1       240104  200
>                       $50000                          $50500
>                       $588                              $599
> 1       240106   464          1       240108  455
>                       $50900                          $56888
>                       $599                              $533
> 2       240201   546          2      240202  555
>                       $55985                       $58499
>                       $539                            $578
>
> The macro should make it look like this:
> class product# totals        class product# totals
> 1       240101   300           1       240101   302
>                       $20000 $23000
>                       $300                               $301
> 1       240102   300
>                       $34000
> $401
> 1       240103   468          1       240103  500
>                       $50000 $24000
>                       $588 $305
> 1       240104  200
>                      $50500
>                      $599
> 1       240106   464
>                       $50900
>                       $599
>                                      1       240108  455
> $56888
> $533
> 2       240201   546
>                       $55985
>                       $539
>
>                                      2      240202  555
> $58499
>                                                          $578
>
> Any help would be greatly appreciated!

From: Mike H. on
So does the data reside in columns 1,2,3 and then 4,5, and 6?