Macro to copy date related date from one sheet and paste into new sheet

excelnovice128

New Member
Joined
Oct 29, 2018
Messages
1
Hi all,

I'm a relative newbie to VBA, macros etc and am trying to learn a few things, was hoping you could help/guide me in the right direction. I am looking to create a macro which will copy data from one sheet and then sort into the correct sheets with the specified data. For example, i want to copy data from the below table into 2 separate sheets:

[TABLE="width: 488"]
<tbody>[TR]
[TD]Sales date[/TD]
[TD]Fruit Sold[/TD]
[TD]Colour[/TD]
[TD]Quantity[/TD]
[TD]Weight[/TD]
[TD]Purchase Price[/TD]
[TD]Sales Price[/TD]
[/TR]
[TR]
[TD="align: right"]01-Jan-18[/TD]
[TD]Apples[/TD]
[TD]Red[/TD]
[TD="align: right"]30[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]20[/TD]
[/TR]
[TR]
[TD="align: right"]02-Jan-18[/TD]
[TD]Apples[/TD]
[TD]Green[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]20[/TD]
[/TR]
[TR]
[TD="align: right"]02-Jan-18[/TD]
[TD]Oranges[/TD]
[TD]Orange[/TD]
[TD="align: right"]84[/TD]
[TD="align: right"]20[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]20[/TD]
[/TR]
[TR]
[TD="align: right"]02-Jan-18[/TD]
[TD]Apples[/TD]
[TD]Red[/TD]
[TD="align: right"]11[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]20[/TD]
[/TR]
[TR]
[TD="align: right"]01-Jan-18[/TD]
[TD]Oranges[/TD]
[TD]Orange[/TD]
[TD="align: right"]69[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]20[/TD]
[/TR]
[TR]
[TD="align: right"]03-Jan-18[/TD]
[TD]Oranges[/TD]
[TD]Orange[/TD]
[TD="align: right"]17[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]20[/TD]
[/TR]
[TR]
[TD="align: right"]01-Jan-18[/TD]
[TD]Oranges[/TD]
[TD]Orange[/TD]
[TD="align: right"]26[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]20[/TD]
[/TR]
[TR]
[TD="align: right"]04-Jan-18[/TD]
[TD]Apples[/TD]
[TD]Red[/TD]
[TD="align: right"]23[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]20[/TD]
[/TR]
[TR]
[TD="align: right"]03-Jan-18[/TD]
[TD]Apples[/TD]
[TD]Red[/TD]
[TD="align: right"]9[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]20[/TD]
[/TR]
[TR]
[TD="align: right"]04-Jan-18[/TD]
[TD]Apples[/TD]
[TD]Green[/TD]
[TD="align: right"]65[/TD]
[TD="align: right"]20[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]20[/TD]
[/TR]
[TR]
[TD="align: right"]01-Jan-18[/TD]
[TD]Apples[/TD]
[TD]Green[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]20[/TD]
[/TR]
</tbody>[/TABLE]

into:

[TABLE="width: 313"]
<tbody>[TR]
[TD]Apples[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]DATE[/TD]
[TD]Quantity Sold[/TD]
[TD]Purchase Price[/TD]
[TD]Sales Price[/TD]
[/TR]
[TR]
[TD="align: right"]01-Jan[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]02-Jan[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]03-Jan[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]04-Jan[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Any help or push in the right direction would be much appreciated!!!

Thanks
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Forum statistics

Threads
1,224,820
Messages
6,181,154
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