SYKEMAKAVELI
New Member
- Joined
- Apr 18, 2023
- Messages
- 9
- Office Version
- 365
- Platform
- Windows
Hi,
I have an excel cell with a range name "Progress_box_toggle", with values "TRUE" or "FALSE". It is contained within an excel tab called "Dashboard".
I want to include code in the Wooksheet_change private sub to hide or show a donut graph based on the value of this range.
If the value is "TRUE", then the donut chart named "Donut_progress_main" should be visible, otherwise it should be hidden.
The code that I've used so far within the Worksheet_change private sub is as follows:
If Not Intersect(Target, Range("Progress_box_toggle")) Is Nothing Then ' check if the changed cell is the one with the range name "Progress_box_toggle"
If Range("Progress_box_toggle").Value = "TRUE" Then ' check if the value of the range is "TRUE"
Sheets("Dashboard").ChartObjects("Donut_progress_main").Visible = True ' show the chart
Else
Sheets("Dashboard").ChartObjects("Donut_progress_main").Visible = False ' hide the chart
End If
End If
For some reason it isn't working.
Does anyone have any suggested changes?
Thanks
I have an excel cell with a range name "Progress_box_toggle", with values "TRUE" or "FALSE". It is contained within an excel tab called "Dashboard".
I want to include code in the Wooksheet_change private sub to hide or show a donut graph based on the value of this range.
If the value is "TRUE", then the donut chart named "Donut_progress_main" should be visible, otherwise it should be hidden.
The code that I've used so far within the Worksheet_change private sub is as follows:
If Not Intersect(Target, Range("Progress_box_toggle")) Is Nothing Then ' check if the changed cell is the one with the range name "Progress_box_toggle"
If Range("Progress_box_toggle").Value = "TRUE" Then ' check if the value of the range is "TRUE"
Sheets("Dashboard").ChartObjects("Donut_progress_main").Visible = True ' show the chart
Else
Sheets("Dashboard").ChartObjects("Donut_progress_main").Visible = False ' hide the chart
End If
End If
For some reason it isn't working.
Does anyone have any suggested changes?
Thanks