Hi guys,
I have created a dashboard in which I have 30 or so graphs. I would like some of the graphs (14 in total) to display only if they meet a condition chosen by two drop downs cell.
In the first drop down cell (let's say A1), the user will chose a day of the week, and depending of that day, the matching graph will display. That is what's being done in the first statement below
Then, in the second drop down (here A50), the user selects another day of the week (independant from the first one) and the graphs will display accordingly. This is my second statement below
However, I came up with two Worksheet_Change which does not seem to work. It seems that I need to combine my two statements. Do you have any ideas how I cold do so?
Here is the code:
Many Thanks!
I have created a dashboard in which I have 30 or so graphs. I would like some of the graphs (14 in total) to display only if they meet a condition chosen by two drop downs cell.
In the first drop down cell (let's say A1), the user will chose a day of the week, and depending of that day, the matching graph will display. That is what's being done in the first statement below
Then, in the second drop down (here A50), the user selects another day of the week (independant from the first one) and the graphs will display accordingly. This is my second statement below
However, I came up with two Worksheet_Change which does not seem to work. It seems that I need to combine my two statements. Do you have any ideas how I cold do so?
Here is the code:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim SelectedChart As Range
Dim blnVisible As Boolean
Set SelectedChart = Range("A1")
blnVisible = SelectedChart.Value = ""
' Make first all charts invisible
ActiveSheet.ChartObjects("Monday").Visible = blnVisible
ActiveSheet.ChartObjects("Tuesday").Visible = blnVisible
ActiveSheet.ChartObjects("Wednesday").Visible = blnVisible
ActiveSheet.ChartObjects("Thursday").Visible = blnVisible
ActiveSheet.ChartObjects("Friday").Visible = blnVisible
ActiveSheet.ChartObjects("Saturday").Visible = blnVisible
ActiveSheet.ChartObjects("Sunday").Visible = blnVisible
ActiveSheet.ChartObjects("Average").Visible = blnVisible
If Not blnVisible Then ActiveSheet.ChartObjects(SelectedChart).Visible = True
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim SelectedChart As Range
Dim blnVisible As Boolean
Set SelectedChart = Range("A50")
blnVisible = SelectedChart.Value = ""
' Make first all charts invisible
ActiveSheet.ChartObjects("EGMs in Use on Monday").Visible = blnVisible
ActiveSheet.ChartObjects("EGMs in Use on Tuesday").Visible = blnVisible
ActiveSheet.ChartObjects("EGMs in Use on Wednesday").Visible = blnVisible
ActiveSheet.ChartObjects("EGMs in Use on Thursday").Visible = blnVisible
ActiveSheet.ChartObjects("EGMs in Use on Friday").Visible = blnVisible
ActiveSheet.ChartObjects("EGMs in Use on Saturday").Visible = blnVisible
ActiveSheet.ChartObjects("EGMs in Use on Sunday").Visible = blnVisible
ActiveSheet.ChartObjects("EGMs in Use Week Overview").Visible = blnVisible
If Not blnVisible Then ActiveSheet.ChartObjects(SelectedChart).Visible = True
End Sub