Shade date headers, if Weekends or Holidays

U

u473

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
 
B

Barb Reinhardt

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)))
 
U

u473

Thank you for the tip.

Now how do I code a Toggle Command Button to Show / Hide the Shaded
Headers Columns ?

Have a good day,

Celeste
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top