creating new cells based on cell value in separate sheet

licorice1969

New Member
Joined
Aug 28, 2019
Messages
2
Good morning ... I'm not sure if this can be done, or even how exactly to describe it, but here goes ...

I need to create a "ballot" file, which I will then refer to after generating a random number using a formula.

I have a source spreadsheet with names and the # of ballots each name gets, what I don't know how to do is to generate a separate worksheet or workbook, which will then put each name in a cell in column A the appropriate number of times.

For example, if the source workbook is:

AB
1John2
2Jane5
3Steve3

<tbody>
</tbody>







... the new worksheet/workbook would look like this:

A
1John
2John
3Jane
4Jane
5Jane
6Jane
7Jane
8Steve
9Steve
10Steve

<tbody>
</tbody>

















Does anyone know how to accomplish this, or even point me in the right direction?

Much thanks in advance for any assistance!

PS - Not sure why there are so many blank lines after the 2nd table, when I edit the post there are none. :confused:
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Hi & welcome to MrExcel.
How about
Code:
Sub licorice1969()
   Dim Cl As Range
   Dim Ws As Worksheet
   
   Set Ws = Sheets.Add
   With Sheets("[COLOR=#ff0000]Master[/COLOR]")
      For Each Cl In .Range("A2", .Range("A" & Rows.Count).End(xlUp))
         Cl.Copy Ws.Range("A" & Rows.Count).End(xlUp).Offset(1).Resize(1 * Cl.Offset(, 1).Value)
      Next Cl
   End With
End Sub
Change sheet name to suit
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,375
Messages
6,119,170
Members
448,870
Latest member
max_pedreira

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