Copy data and pasting multiple times using macro

Posts
2
Registration date
Thursday January 31, 2019
Last seen
January 31, 2019
- - Latest reply: ac3mark
Posts
11385
Registration date
Monday June 3, 2013
Status
Moderator
Last seen
February 19, 2019
- Jan 31, 2019 at 04:03 PM
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!
See more 

Your reply

1 reply

Posts
11385
Registration date
Monday June 3, 2013
Status
Moderator
Last seen
February 19, 2019
2143
0
Thank you
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.

Jlaro
Posts
2
Registration date
Thursday January 31, 2019
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.
ac3mark
Posts
11385
Registration date
Monday June 3, 2013
Status
Moderator
Last seen
February 19, 2019
2143 -
Can you build a for loop?
Respond to ac3mark