PDA

View Full Version : Solved: Help with conditional formatting



gcapp
01-17-2013, 06:18 AM
I am new to using VBA and I'm hoping someone may help.

This seems to be simple but.....

I have a worksheet in Excel 2010 that has all the days of the year (ex. 1/1/13) down column A and the corresponding days of the week (ex. Monday) down column B.

What I need is if the days of the week are Saturday and Sunday (in this example cells B5 & B6) then I need the cells directly to the left (in this case cells A5 & B5) have a background color of gray AND the 7 cells directly to the right (in this case cells C5 thru I5 and C6 thru I6) to have a background color of gray.

It seems pretty straight forward but I just can't figure it out.

I have attached a simple file of what it should look like.

If anyone can help, I would be greatly appreciative.

GarysStudent
01-17-2013, 06:41 AM
Please give the attached a try.

gcapp
01-17-2013, 06:55 AM
Thank you GarysStudent for the file (very appreciative!!) but when I opened the file all the cells have a white background. All the dates and days are listed, but all have white backgrounds. Am I doing something wrong??

gcapp
01-17-2013, 06:56 AM
And when I open your spreadsheet and click Macros and choose to Run yours, still nothing happens. :(

gcapp
01-17-2013, 06:58 AM
Oops I'm sorry - yes it did work. Not sure what I clicked wrong, but it does work!! Thank you so much!!!!!!!!!!!!!

GarysStudent
01-17-2013, 07:03 AM
You are quite welcome!

gcapp
01-17-2013, 08:00 AM
GaryStudent - one last question, if you will. I noticed that your script works on the current worksheet. How can I get that script to work on multiple worksheets within the excel file?? Thank you again

gcapp
01-17-2013, 09:35 AM
I found out why it did not work on all sheets - Thank you again