I have a table that looks like this:
<tbody>
</tbody>
I have a COUNTIF formula and a MAX formula that will count the number of repeating invoice numbers. So the last 2 columns are the page number and the last page number. I need some kind of VB code that will do a FOR NEXT (?) loop in the case of invoice 3063617 it will copy an existing worksheet call ADDPAGE and rename it to PAGE 2, 3, 4 for each of pages 2 thru 7. I also need to populate amount field on each page. Page 1 is already created and assumed for all invoices.
Any Ideas?
Company | Invoice | Amount 1 | Amount 2 | Amount 3 | Amount 4 | Amount 5 | Page | Last Page |
John Q Company | 3063615 | $ 101 | $ 200 | $ 25 | $ 25 | $ 25 | 1 | 1 |
Peter North Company | 3063616 | $ 999 | $ 877 | $ 66 | $ 66 | $ 66 | 1 | 1 |
Sam South Company | 3063617 | $ 205 | $ 180 | $ 154 | $ 164 | $174 | 1 | 7 |
Sam South Company | 3063617 | $ 333 | $ 195 | $ 225 | $ 375 | $ 22 | 2 | 7 |
Sam South Company | 3063617 | $ 777 | $ 987 | $ 444 | $ 200 | $ 33 | 3 | 7 |
Sam South Company | 3063617 | $ 105 | $ 111 | $ 555 | $ 344 | $ 44 | 4 | 7 |
Sam South Company | 3063617 | $ 116 | $ 137 | $ 555 | $ 65 | $ 55 | 5 | 7 |
Sam South Company | 3063617 | $ 140 | $ 245 | $ 666 | $ 242 | $ 66 | 6 | 7 |
Sam South Company | 3063617 | $ 150 | $ 333 | $ 666 | $ 255 | $ 77 | 7 | 7 |
Sam South Company | 3063618 | $ 126 | $ - | $ - | $ - | $ - | 1 | 1 |
New York East Company | 3063619 | $ 5,905 | $ - | $ - | $ - | $ - | 1 | 1 |
<tbody>
</tbody>
I have a COUNTIF formula and a MAX formula that will count the number of repeating invoice numbers. So the last 2 columns are the page number and the last page number. I need some kind of VB code that will do a FOR NEXT (?) loop in the case of invoice 3063617 it will copy an existing worksheet call ADDPAGE and rename it to PAGE 2, 3, 4 for each of pages 2 thru 7. I also need to populate amount field on each page. Page 1 is already created and assumed for all invoices.
Any Ideas?