VBA: Copy specific cells to another worksheet

FatWhale38

New Member
Joined
Nov 2, 2017
Messages
8
Office Version
  1. 2007
Platform
  1. Windows
Dear all

I am having trouble trying to put together a macro.

In Sheet1, I have my data table. I put a simplified version below:

[TABLE="width: 500"]
<tbody>[TR]
[TD]Gender[/TD]
[TD]Breed[/TD]
[TD]City Council[/TD]
[TD]Microchip Number
[/TD]
[TD]Status[/TD]
[/TR]
[TR]
[TD]M[/TD]
[TD]Dog[/TD]
[TD]Council A[/TD]
[TD]1030999876287540[/TD]
[TD]Adopted[/TD]
[/TR]
[TR]
[TD]F
[/TD]
[TD]Dog[/TD]
[TD]Council C[/TD]
[TD]4425588004585700[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]F
[/TD]
[TD]Cat[/TD]
[TD]Council B[/TD]
[TD]8735364841765360[/TD]
[TD]Adopted[/TD]
[/TR]
[TR]
[TD]M[/TD]
[TD]Cat[/TD]
[TD]Council A[/TD]
[TD]3351709516296290[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

If the animal has been adopted, I need to move the details to Sheet2.

I need to make 3 rows for each entry (one for the family adopting the animal, one for the council and one for our records).

I have to copy the relevant details in to specific cells in Sheet2 ie:
- microchip number to cell K2 (through till K4)
- Council details in L2 (through till L4)
etc.

And then repeat for the next adopted animal.

How do I script the macro to save me from having to copy paste every single row manually?

Many thanks in advance!
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Another thought:

Would it be possible to have in another column, defining say M2 and the macro copies the C2 (ie the council details) to M2 in Sheet2?

Thanks again!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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