Copy to sheet based on cell value

Bengo

Board Regular
Joined
Apr 14, 2010
Messages
210
Hi, I am trying to write a macro to copy data from a master sheet, to the relevant supplier sheet, based on the name in one of the cells

For example, in A1 to D1 of the master sheet I might have:

19/12/2017 | SUPPLIER A | £5000 | MANAGER A

And in A2 to D2:

19/12/2017 | SUPPLIER B | £1000 | MANAGER B

I'd like to be able to run the script to add the info in row 1 to a worksheet I already have named as "SUPPLIER A", and the info from row 2 to be copied to a worksheet already named "SUPPLIER B"

I am working on a VBA based on highlighting the desired cells and copying them to the relevant worksheet, but and struggling to make the destination worksheet be based on which supplier is in the info. Hope this makes sense! Any help would be much appreciated! Thanks
 
Thanks, I am still getting a range error on the following:

OSht.Range("A6:A" & UsdRws).SpecialCells(xlCellTypeVisible).EntireRow.Copy _
Sheets(Cl.Text).Range("A1")

I code has filtered my data by the first supplier and then stopped
 
Upvote 0

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
What is the value of Cl.Text when you get the error & do you have a sheet with that exact name?
 
Upvote 0
Ah I've seen my mistake! I misread your code and thought it created the supplier tabs. I've now set these up for each supplier and it runs great! Thank you so much for helping me with this!
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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