Auto Populating Using Macro

MarkAn

Board Regular
Joined
Sep 28, 2005
Messages
69
Office Version
  1. 2010
Hi

I'm hoping that someone can please help me.

I have a spreadsheet with x2 tabs and I have imaginatively named them "1" and "2".

On tab 1 there is a table
Column A represents the "Name" & cells A2-A5 have names in I.e. Mark, Paul, Adam and Cy
Cells B1 & C1 have been merged and have the number 1 in
Cells D1 & E1 have been merged and have the number 2 in
Cells F1 & G1 have been merged and have the number 3 in
Cells B2-B5, D2-D5 and F2-F5 have a number in and this can be any number
Cells C2-C5, E2-E5 and G2-G5 are currently blank but have a count formula in

On tab 2 there is information across several columns, however, Column A is blank and Column E has the numbers 1, 2 or 3 in every cell up to row 1368. What I want the Macro to do is to enter the names Mark, Paul, Adam and Cy into the cells of Column A based on the information in the table of tab 1.

I.e the table shows that "Mark" has the number 33 in Cell B2 for the number 1, the Macro would then auto populate 33 cells in Column A of tab 2 for every corresponding '1' in Column E. It will stop when the count formula in cell C2 on tab 1 has counted the correct number needed.

It will then move onto the next name until it has auto-populated Column A on tab 2 for all 1's in Column E. It will then move onto all 2's.

Also to consider is if there is an error, in that there were not enough 1's available for the numbers entered on tab 1 as the figures were rounded up. It should just populate as many that are available.


I'm sorry if the above sounds very confusing but hopefully have conveyed what I am trying to do. I have very basic Macro knowledge so this will help out a lot and cut down on a lot of wasted time.

Any help will be greatly appreciated.

Many thanks for looking.
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Forum statistics

Threads
1,223,270
Messages
6,171,102
Members
452,379
Latest member
IainTru

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