ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Shade date headers, if Weekends or Holidays (https://www.excelbanter.com/excel-programming/409686-shade-date-headers-if-weekends-holidays.html)

u473

Shade date headers, if Weekends or Holidays
 
Sheet1 with Column Date headers, for the next 18 Months.
Sheet2 with Holidays Dates in Column A
Questions :
1. How do I shade the headers with VBA for Weekends & Holidays ?
2. How do I, on Button-Click, Toggle Hide / Unhide the columns with
shaded headers
Thank you for your help,

Celeste

Barb Reinhardt

Shade date headers, if Weekends or Holidays
 
First, you're going to have to create a named range for HOLIDAYS on Sheet2.
If you have a header in Sheet2!A1 try this

=OFFSET(Sheet2!A1,1,0,COUNT(Sheet2!$A:$A)-1,1)

If there is no header, use this

=OFFSET(Sheet2!A1,0,0,COUNT(Sheet2!$A:$A),1)

For the conditional format, put this

=OR(WEEKDAY(A1,2)=6,ISNUMBER(VLOOKUP(A1,HOLIDAYS, 1,FALSE)))
--
HTH,
Barb Reinhardt



"u473" wrote:

Sheet1 with Column Date headers, for the next 18 Months.
Sheet2 with Holidays Dates in Column A
Questions :
1. How do I shade the headers with VBA for Weekends & Holidays ?
2. How do I, on Button-Click, Toggle Hide / Unhide the columns with
shaded headers
Thank you for your help,

Celeste



All times are GMT +1. The time now is 07:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com