Highlight all cells of the same category in a calendar dashboard

samc2696

New Member
Joined
Jul 16, 2018
Messages
42
Hi all,

I have a calendar in year view that has the dates coloured based off of the type of event it is e.g. meetings are orange, reports due are blue etc etc

At the top, I have a legend/key, and what I want to achieve is that if the user clicks the Legen that is for meetings (orange) then all the cells within the calendar range that are of that category become highlighted (i.e. go to a darker orange or however specified)

Is that possible at all?

To give some background, the calendar is 'populated' using a Events Table on another sheet which has the date, event title and category (amongst other info). When a new event is added, the conditional formatting on the calendar automatically recognises this and based on the event type, fills the correct date's cell. (It is difficult to explain without images or a workbook attached - but it is based on a post by Chandoo found here)

Because of this event type that is assigned to each event, I think there must be a way of linking all the cells that meet that condition with the Legend/Key but I just do not know how!

Thank you
Sam
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Here is a start to your question:

Needs to be enter on the specific sheet that the user will be clicking on the Legend (you can right click on the Tab Name and select View Code to enter this VBA Code)

Code:
Option Explicit


Private Sub Worksheet_SelectionChange(ByVal Target As Range)


Dim rngCell As Range, Rng As Range, DataSet As Range, Cell As Range


 Set DataSet = Sheet1.Range("A7:I13")
 Set Rng = Sheet1.Range("A1:A3") 'Currently set to Sheet1, you can change to Sheets("Name") if needed
     
     MsgBox Target '-------------Remove this after you have tested
 
 For Each Cell In DataSet
     If Cell.Value = Target Then
         Cell.Interior.Color = RGB(255, 255, 0)
 Else
   
Cell.Interior.Color = xlNone
   
     End If
   
 Next Cell 'Loop Thru dataset
        
End Sub

You will need to write mutliple if Statements to get it to change to the various colors you mentioned.
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,623
Latest member
Techenthusiast

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