Creating Duplicate Cells Based on Criteria

jrowland

New Member
Joined
Jul 3, 2009
Messages
7
Hello,

I need to create a macro that will duplicate cells a set number of times based on criteria in another cell. For example, I have:

Code:
A1             B1
John          3
Mike          1
Bill            5
And I would like to have:

Code:
A1
John
John
John
Mike
Bill
Bill
Bill
Bill
Bill
http://www.mrexcel.com/forum/showthread.php?t=431282

Is pretty close to what I'm looking for, but I couldn't adapt that code to work with my present list.

Thank you for your time.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Try

Code:
Sub Rpts()
Dim LR As Long, i As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
Columns("A").Insert
For i = 1 To LR
    Range("A" & Rows.Count).End(xlUp).Offset(1).Resize(Range("C" & i)).Value = Range("B" & i).Value
Next i
Columns("B").Delete
Range("A1").Delete
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,036
Messages
6,122,794
Members
449,095
Latest member
m_smith_solihull

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