i have a spreadsheet i use monthly and was wondering if there is a way to get the weekend dates to grey out so as i enter the information into the sheet i don't enter anything into these cells in error. the date is in column A and i have information through AD.
I assumed you want the entire row, not just the date cell, to be greyed out. The are two ways to accomplish this: via conditional formatting, and via macro. I chose the macro approach because putting conditional formatting in all the cells would add quite a bit of overhead to your workbook, and possibly interfere with other conditional formatting you might have. So here is a simple macro that will do it:
'greys out all rows of the active worksheet that have weekend dates in column A
Dim iRow As Long
For iRow = 1 To Range("A65536").End(xlUp).Row
If IsDate(Cells(iRow, "A")) Then
If Weekday(Cells(iRow, "A"), vbMonday) > 5 Then Rows(iRow).Interior.ColorIndex = 15
To install this in your workbook go to the Visual Basic Editor (keyboard Alt-TMV), insert a new macro module (Alt-IM) and paste this code into the code pane. To run the macro go back to Excel and Alt-F8, select the macro and click Run.
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here