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
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