Macro Code for searching and pasting to another worksheet

AF1987

New Member
Joined
Oct 11, 2017
Messages
1
Hi

Really new to VBA and Macro's so any help would be much appreciated :eeek:

I have a spreadsheet that contains data that needs to be pasted to a different worksheet depending on cell value.

For instance:

[TABLE="width: 207"]
<colgroup><col width="116" style="width: 87pt; mso-width-source: userset; mso-width-alt: 4242;"> <col width="82" style="width: 62pt; mso-width-source: userset; mso-width-alt: 2998;"> <col width="77" style="width: 58pt; mso-width-source: userset; mso-width-alt: 2816;"> <tbody>[TR]
[TD="width: 116, bgcolor: transparent"]Cash Net[/TD]
[TD="width: 82, bgcolor: transparent"]CASH Vat[/TD]
[TD="width: 77, bgcolor: transparent"]CASH Gross[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]22.5[/TD]
[TD="bgcolor: transparent, align: right"]0[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]7.5[/TD]
[TD="bgcolor: transparent, align: right"]0[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]385.2[/TD]
[TD="bgcolor: transparent, align: right"]0[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]6.99[/TD]
[TD="bgcolor: transparent, align: right"]0[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
</tbody>[/TABLE]

I need to code to search the worksheet for Cash Net, Cash Vat, Cash Gross and if found paste the cells directly below it into specific cells in a new worksheet.

I can do this using the Macro recorder but...

The work sheet in question may not ALWAYS contain Cash Net, Cash Vat or Cash Gross. And sometimes the values might be found in different cells. So basically, if the worksheet does not contain Cash Net, I need it to ignore that and move onto searching for Cash Vat. Cash Net maybe in cell A1 (for instance) in one sheet but A4 in another sheet.

Any help on this would be fantastic and give me a great start on my project.

Thanks,
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,632
Latest member
jladair

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