Copy Paste in another worksheet based on cell value vba

Penny110

New Member
Joined
Feb 26, 2015
Messages
3
Hi, I'm new with VBA but did quite a bit of macros last week with the help from this forum. Now I'm stuck with this one and can't figure it out. Any help is much appreciated.

I have a schedule something like this on Sheet1:

NameMonTueWed
JohnSurrey 0900-1700Van 1230-1945APH 0745-1515
SueSurrey 0715-1600APH 0900-1700APH 0900-1700
MikeAPH 0715-1600APH 0900-1700APH 0745-1515
DanAPH 0900-1700Surrey 0715-1600

<tbody>
</tbody>




for each day of the week, shows the location and shift hours for each staff.
On Sheet2 = "Monday" I have the required shifts for each location on Mondays. something like this. I have 7 worksheets for 7 days of the week.
MonMon
APH 0715-1600Surrey 0715-1600
APH 0900-1700Surrey 0715-1600
APH 0900-1700Surrey 0900-1700
APH 0745-1515Surrey 0900-1700
Surrey 0800-1730

<tbody>
</tbody>

I need a macro to get the value of the first required shift for APH location (APH 0715-1600) and search in Sheet1 under Mon column, find the value, copy the corresponding staff name and paste it on Sheet "Monday" beside the first required shift on the left side cell. Then this repeats for the second required shift and so on. Then should go to the next location i.e. Surrey and starts with first required shift for Surrey (Surrey 0715-1600) and ...

The result should be like:


MonMon
MikeAPH 0715-1600SueSurrey 0715-1600
DanAPH 0900-1700Surrey 0715-1600
APH 0900-1700JohnSurrey 0900-1700
APH 0745-1515Surrey 0900-1700
Surrey 0800-1730

<tbody>
</tbody>


At the end I should know the required shifts that have no one assigned to and should be offered to staffs.

On Sheet1, not all staffs have an assigned shifts (some cells are blank). The cells are color coded by location.
On Sheet "Monday", there might be 2 or more of a same shift required.

Let me know if I need to provide more info.

Thanks in advance,
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,214,946
Messages
6,122,401
Members
449,081
Latest member
JAMES KECULAH

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