Compare a cell to a range of cells in VBA

kastsnow

New Member
Joined
Oct 10, 2011
Messages
12
Hello all... I have been struggling building a automated schedule for my mother. She works at a hospital and there are 8 nurses on a rotating 14 week schedule. Starting in 2012; ending in 2015

-WHAT I HAVE COMPLETED-

1st - the monthly calendar changes dates and days depending on the year selected and month selected in two drop down boxes

2nd - I managed to compare each years holidays to the month selected the days will turn the cells a red is a stat holiday or yellow if its a weekend

-What I NEED-

1st - Now the the calendar is self populating I was looking for some sound logic to help populate the schedule for each person referencing the rotation number 1-14 and what day it is in Mon-Sun... each person would have a different shift depending on those variables.

does this make sense and is this at all do able

-WHAT I WAS THINKING-

in VBA compare the date to the holidays to ensure its not a weekend nor a stat holiday first
*IF cells(1,1) = range (10,10):(15,15) ' i dont know how to do ranges.
then nurse "A" gets the day off else
if cells(1,1) = "1-Jan" and "monday" then nurse A works a "Day"
etc etc etc...

do you think if then else is the way to create such a program or is there an easier way? I have taught myself and will work very hard to try any suggestions... I really wanna learn VBA. It will help with my job also.

Thanks for your time,
Kastsnow

if you need anymore info let me know!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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