VBA match cells Help

RickeyS

Board Regular
Joined
Jun 23, 2006
Messages
222
Hi, I need to vba code for the following:

I have a spreadsheet with names in cells C16:I43 what I need to do is if a the same name appears in row C & D highlight those cells with the same name and then do this for rows D & E, then E & F, then F & G and so on.

The way my spreadsheet is layed out is row C & D is day one row E & F is day two row G & H is day three and so on, then row C would be day work and row D night, row E day work and row F night work and so on.

What I'm trying to do is make sure that the same person is not scheduled for day work on day one and then scheduled for night work on day one, or for night work on day one and day work on day two, etc.

Hope this makes sense.
Thanks
Rick
 
pcg01, sorry I did paste you code into vba, but I'm still learning here, I didn't realize that you then had to run via a macro. It does work, I need to use your first example as the name can appear in a different column on different shifts. One problem I having is that after I run your code and see where a employee is scheduled for two shifts in a row and correct that employee so not to have a double shift the cells stay green, even if I run your code again after fixing the double shift. Is there a way to correct this? Thanks for all your help so far.
Thanks
Rick
 
Upvote 0

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.
If this can be done with conditional formatting, how would I do that. I know how to access conditional formatting just don't know how to do what I need it to.
Thanks
Rick
 
Upvote 0

Forum statistics

Threads
1,215,756
Messages
6,126,689
Members
449,329
Latest member
tommyarra

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