Copy data and pasting multiple times using macro [Closed]

Report
Posts
2
Registration date
Thursday January 31, 2019
Status
Member
Last seen
January 31, 2019
-
 Blocked Profile -
Hello,

So I am having trouble determining what code to use to past value. The situations is as follows:

On Sheet1 I have a list of names in column A, as well as a list of how many times I need to copy and past the name in column B.
Example: A1= John, B1=15
A2= Larry, B2= 23
A3= Bob, B3= 55
A4= Jeff, B4= 18

What I need is to copy John's name 15 time, Larry's 23, Bob's 55, and Jeff's 18. Then have those names past in Sheet2 column J their respected number of time.
Example End Result: J1-15 will have John's name
J16-38 will have Larry's name and so on...

The values in column B will change on a daily basis.

Thank you for your help!

1 reply

This has no business application, and appears to be a homework assignment. Please complete your own homework, as you will learn nothing if you don't do it yourself.

here is a hint. Build your for loop using the values in the cell. So your loop could be built as:
Thecount = cell ("b2").value
For theloop = 1 to thecount
Do your code here
Next

That should give you a good head start.

Posts
2
Registration date
Thursday January 31, 2019
Status
Member
Last seen
January 31, 2019

This is for business. I'm looking to be able to assign work item to individuals. The number of items changes on a daily basis (column B). An there are several thousand items so trying to manually enter can copy/past is not efficient.
Can you build a for loop?