Best Formula or VBA to Highlight range of dates on a Calendar?

pvtjoker77

New Member
Joined
Aug 31, 2015
Messages
13
Office Version
  1. 2016
Platform
  1. Windows
Hello Friends,

I'm trying figure out the best way to highlight the users Days Off on a calendar based off of their selection of dates.

So on Sheet1 I have a Calendar and on that same sheet I have a Form control spinner for the user to select a Letter B thru J

Capture4.PNG


and on sheet2 starting at Row 2 I have the 11 columns of 130+ rows of dates for that year that represents all of their scheduled days off.

Capture 1.PNG



I'm trying to make it that if the user selects B or whatever letter on the spinner all the dates on that particular column highlight on the calendar like I have some holidays highlighted.

Capture3.PNG


I'm not quite sure how I can make this happen weather is through VBA or formulas.. Any help is appreciated!

Thank you in advance :)
 

Attachments

  • Capture2.PNG
    Capture2.PNG
    1.9 KB · Views: 10

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Hi pvtjoker,

Here's one way to do it:

  1. Ensure that the days in your calendar are actual dates, not just a number that represents the day.
    1. Then, format the calendar's cells to be formatted with a custom format of "dd" to just see the day values.
  2. Highlight the range of cells that cover the calendar.
  3. Apply a Conditional Format using a Custom New Rule.
    1. Use this formula and modify to meet you sheets.
      1. =COUNTIF(INDIRECT("Sheet2!"&$A$4&"2:"&$A$4&"6"),C2)
        1. $A$4 = the cell that the the letter "B" appear in your example
        2. "6" = the last row that your staff have days off on.
          1. Could be set to like... 100 or something. That's up to you to determine
        3. C2 = the first cell in the calendar's date range.

CalendarDaysOff.gif
 
Upvote 0
Solution
Hi pvtjoker,

Here's one way to do it:

  1. Ensure that the days in your calendar are actual dates, not just a number that represents the day.
    1. Then, format the calendar's cells to be formatted with a custom format of "dd" to just see the day values.
  2. Highlight the range of cells that cover the calendar.
  3. Apply a Conditional Format using a Custom New Rule.
    1. Use this formula and modify to meet you sheets.
      1. =COUNTIF(INDIRECT("Sheet2!"&$A$4&"2:"&$A$4&"6"),C2)
        1. $A$4 = the cell that the the letter "B" appear in your example
        2. "6" = the last row that your staff have days off on.
          1. Could be set to like... 100 or something. That's up to you to determine
        3. C2 = the first cell in the calendar's date range.

View attachment 43778
Is it possible to make it work if the cells were Custom formatted to "d" vs "dd"? just wondering.. Other than that it worked like a charm! Thank you again!!!!
 
Upvote 0
Yes, just a single "d" is fine. Formatting just masks the cell's contents, it doesn't alter their value.
 
Upvote 0

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top