ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro to copy data X number of times into a column (https://www.excelbanter.com/excel-discussion-misc-queries/446994-macro-copy-data-x-number-times-into-column.html)

WSD

Macro to copy data X number of times into a column
 
Hello,

New to Excal/VBA and need a little help for a macro I've been trying to create. I've tried a few things and looked around numerous places however cannot find the solution to my problem. I am currently using Excel 2010, but will require this to work in Excel 2003 if possible.

I have 2 Excel Sheets:
- Sheet1 will contain data/item that change on a daily basis and are pasted into the document from another spreadsheet. The data is located from A6:G? (where ? will vary from day to day).
- Sheet2 contains a list of names in columnA (number of names will vary on an occasional basis) and a list of corresponding numbers in columnC.

I am trying to create a macro that will copy, multiple times, the names from Sheet2 columnA into Sheet1 columnH (starting at H6) based on the number which is in Sheet2 columnC.

Essentially, I am trying to 'assign' the items in Sheet1 to the people in Sheet2 based on the number entered.


Example:

Sheet1
ColA:G ColH
item1 Name1
item2 Name1
item3 Name2
item4 Name3
item5 Name3
item6 Name3

Sheet2
ColA ColC
Name1 2
Name2 1
Name3 3

Thanks for any help you can provide!


All times are GMT +1. The time now is 10:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com