Avatar of oranco
oranco
 asked on

Replicate rows based on multiplier field

Hi,

I need to print labels from an Excel list. Easy, just merge to Word.

There is a twist tho. My Excel list is as follows:

column A       column B
name1                  5
name2                  4
name3                  6

Column B is the multiplier that dictates how many of each label i need. So in the example I'll need to create 5 labels with 'name1', 4 with 'name2' and 6 with 'name3'. My list goes up to name200 so clearly i dont want to do it manually. As a standard merge utilises one row per label, how do i replicate the rows in line with the number in column B?

thx
Microsoft ExcelMicrosoft Word

Avatar of undefined
Last Comment
Ingeborg Hawighorst (Microsoft MVP / EE MVE)

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
nutsch

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
oranco

ASKER
hi Nutsch,

Thanks for that. Sadly i have no idea how to run it. Where do you declare column A and column B?

Also, since i wrote you last night there is an additional request. We would like to be able to add a running count of bags per label so that, using the above example, we'll have two more columns outputted one of which is bag number, and one is how many bags total so i can merge x bag out of y to the final label.

nutsch

column A and B are declared as their numbers in line 12, 16 and 17. cells(something, 1) refers to column A.

To run this macro, go into VBEditor (Alt+F11), insert a module, copy the code, then press F5 (or Alt+F8 if you're in the worksheet)

Try this and we'll check out the other request once you have that going.

T
oranco

ASKER
hi,

sorry for the delay in responding. this ended up being taken care of by one of our programmers. thanks for you efforts but the urgency dictated an alternative solution

apologies

Oran
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Ingeborg Hawighorst (Microsoft MVP / EE MVE)

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.