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:
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
32,124
Office Version
365
Platform
Windows
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
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
32,124
Office Version
365
Platform
Windows
You're welcome & thanks for the feedback
 

Forum statistics

Threads
1,081,793
Messages
5,361,316
Members
400,625
Latest member
Asraful Alam

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top