Macro copy cells based upon datat to another worksheet

cory99

New Member
Joined
Apr 17, 2013
Messages
5
I am still trying to learn this and am working on a project and if I could get this into a macro it would save me alot of time.

Worksheet I need cells copied from is called County and data starts on row 3 and in column D there will be either a 1,2,3 or 4. If the row has a 1 I need to copy the corresponding cell data in a:c and insert in worksheet scale row 45, if 2 copy/insert in row 27, if 3 copy/insert in row 20 and if 4 copy/insert in row 6.

Any help would be greatly appreciated
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
It would be helpful with a picture of some sort :) If you just have 3 cells you are copying data from, could you not just do an IF() function that either puts a 0 or the numbers into the other sheets? That seems like a better solution to me based on what I understood of your description...
 
Upvote 0
I tried to attach a sample but was having trouble, i first looked at doing using if but since i will eventually be doing it for all states and updating the data every few months i figured this would be easiest but i could be wrong on that.

Here would be worksheet County and based upon column d I would want to copy and paste a:c to scale worksheet
Location
Population
Households
Category
Adair
25,567
10,405
4
Andrew
23,657
12,456
3
Barry
56,875
23,845
2

<tbody>
</tbody>

Here would be worksheet scale and the data from county is used to populate some other formulas from here but just need an easy way to update this since I may change the category or other data frequently.
Level 4
Adair
25,567
10,405
Level 3
Andrew
23,657
12,456
Level 2
Barry
58,875
23,845
Level 1

<tbody>
</tbody>
 
Upvote 0
So thinking it through some more I actually need to do something a little different.

Worksheet I need cells copied from is called County and data starts on row 3 and in column D there will be either a 1,2,3 or 4 which is what will be the basis for what cells to copy where.

If the row has a 1 in column d I need to copy the corresponding cell data in a:c and insert in worksheet scale above the row that has level 1 subtotal in column a and so of for level 2,3,4.


Here would be the scale worksheet
Level 4
LocationTotal PopulationTotal Households
Adair 25,59710,405
Level 4 Subtotals109,82444,644
Level 3
LocationTotal PopulationTotal Households
Adair 25,59710,405
Andrew 17,3587,056
Level 3 Subtotals109,82444,644
Level 2
LocationTotal PopulationTotal Households
Adair 25,59710,405
Level 2 Subtotals109,82444,644
Level 1
LocationTotal PopulationTotal Households
Adair 2559710405
Level 1 Subtotals109,82444,644

<colgroup><col><col><col></colgroup><tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,213,530
Messages
6,114,163
Members
448,554
Latest member
Gleisner2

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