I am trying to write a code using vba that allows me to automatically create a schedule in excel that changes grey squares to white squares based on hours scheduled. The sheet contains a column of the names of all the employees working on a particular day with a cell next to it showing what hours they are working. Then there is a column for each hour that our business is open from 8am to 9pm. The hours show as a text string that reads exactly (for example) "12:00p-8:00p" so I need to make the the cells in that row from 12pm to 8pm turn white (they are default grey). So it would read something like this (G being grey and W being white):
First cell contains employee name. Second hours scheduled. Next 13 cells = hours we are open.
|Sam Smith|12:00p-8:00p|G|G|G|G|W|W|W|W|W|W|W|W|G|
So when I import my weekly schedule into the appropriate cells, I need to be able to click a button that automatically turns those cells grey or white depending on the two different values in the text string, which is where I can't seem to get any help, I need excel to somehow know for instance that I need my if statement to say basically if the first time in the text string is '12:00p' then anything greater than that should be a white cell but only until the '8:00p' in the text string, which is way beyond my expertise.
Any help would be greatly appreciated. If this is already covered and I missed it a link would be great, but I can't seem to find it, thanks!
Aucun commentaire:
Enregistrer un commentaire