Is there any way?

SunnyB01

New Member
Joined
May 9, 2017
Messages
2
Hey All,

After searching for what felt like 73 days, I am hoping someone can help me!!! Here is the situation... I am attempting to mail merge in word from an excel document to print ticket entries for a giveaway, which is simple enough, but here is where it gets tricky - Before I mail merge, I am hoping there is a way to have excel expand the rows of data based of the quantity column. For example, in the table below, I am hoping there is a way to have excel create 6 rows of data for Doug Smith, 12 for Bill Williams, etc as I need to print an individual entry to match the quantity of entries each person has. Or if there is a way to do it via the mail merge in word.

IDFIRST NAMELAST NAMEQTYDESCRIPTION
224DougSmith6Prize 1
421BillWilliams12Prize 2
582AustinDavis2Prize 3
779MelissaJohnson9Prize 3

<tbody>
</tbody>


Thank you so much in advance for even looking at this and I am hoping someone out there will be my savior!
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
try this on a copy of you file.

It assumes you data is in columns A:E.

it will create a new list in G:K

Code:
Sub Macro1()
Range("G:K").ClearContents

For r = 2 To Cells(Rows.Count, "A").End(xlUp).Row

sr = Cells(Rows.Count, "K").End(xlUp).Row + 1
lr = sr + Cells(r, "D").Value - 1

Range(Cells(sr, "G"), Cells(lr, "K")) = Range(Cells(r, "A"), Cells(r, "E")).Value

Next r
End Sub

hth,

Ross
 
Upvote 0
Ross -

You are my hero! Thank you so much!

Best,
Brooke


try this on a copy of you file.

It assumes you data is in columns A:E.

it will create a new list in G:K

Code:
Sub Macro1()
Range("G:K").ClearContents

For r = 2 To Cells(Rows.Count, "A").End(xlUp).Row

sr = Cells(Rows.Count, "K").End(xlUp).Row + 1
lr = sr + Cells(r, "D").Value - 1

Range(Cells(sr, "G"), Cells(lr, "K")) = Range(Cells(r, "A"), Cells(r, "E")).Value

Next r
End Sub

hth,

Ross
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,693
Members
448,979
Latest member
DET4492

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top