Copy row header value based on different column values

  • Good Afternoon,

    I am trying to set up a list of data to do a mail merge into Word Labels.

    The Current macro copies the required columns (Products) to a new Sheet(Labels). Once copied, the rows are duplicated based on the total quantity so that the correct no of labels are printed.

    From here...and I am not sure where to even start, I would like to take the Size of each garment and copy n times based on the count in the column. Sheet 3 shows what the end result should look like. Workbook attached.

    Thanks for your help.

  • Re: Hi, No in the actual file only the required columns for the labels are copied across. There are many cols that are irrelevant. Cheers

    Tells us totally nothing.

    If you don't attach an exact copy of your workbook explaining in detail what needs to be included and what needs to be excluded, you'll end up with

    a multitude of posts that needs to change to get your desired result.

    A proper explanation should only need one or two answers that give you the desired result.

  • Hi, Understood, but the actual file contains lots of company sensitive information which I am unable to upload. The data and I have created in this file represents what the macro is trying to achieve. The labels only contain Product Code, Description, Colour and Size and a barcode which will be added later. Cheers.

  • Re: contains lots of company sensitive information

    That's the advantage of having a keyboard with a computer. That can be changed to non sensitive text.


    Your attachment has in the one sheet 10 headers and in the next sheet 9 headers.

    In Post #4 you say 3 columns = sizes(5) = 8 + total = 9

    So is it safe to assume that the 2nd sheet (label) is the setup to go by?

  • I cleared "Products" sheet.

    I copied columns A to I data from "Label" sheet into "Products" sheet.

    I cleared the data (Columns A to I) in "Label" sheet. "Label" sheet is now totally empty.



  • Hi Jolivanes,

    Sorry for the confusion.

    In my company worksheet there are many other tabs which are interlinked with formulas and lookups. I could probably delete those and then replace all formula's with static values and change the data but I thought it simpler to give an example which mirrored what I was looking to achieve. If you prefer I do this then I can.
    The products tab (10cols) contains all the info for each product

    The Labels tab extracts only the information that is required for each label, hence only 9 columns.

    Sorry..I'm a bit lost re Post #4?

    To merge with MS Word, each product has to be on a different row..which the code does..I just don't quite know how to get the Size (XS,S etc) in a column.

    Hope this makes a little more sense.

  • Hi,

    Thanks for the file and for your time to assist. It is very much appreciated. That worked great. I added one further row to copy down the size Label into the last column as well.

    Cheers and have a good day.