MissingInAction
Board Regular
- Joined
- Sep 20, 2019
- Messages
- 85
- Office Version
- 365
- Platform
- Windows
Hi everyone. I want to hide checkboxes based on the condition of another checkbox. If that box is checked, the other should show, if not checked, then the others should not show.
I have linked the main checkbox to cell G140. When ticking/unticking the checkbox, G140 turns to TRUE/FALSE, as it should.
The problem is the boxes are not showing until I enter a random value in a random cell. I think it has to do with the VBA code not running when a checkbox is checked, but only when the sheet information changes. Here is the code I'm using:
I have used similar code (only the shape names are different) in other instances where it is linked to a dropdown menu containing "yes" or "no". If yes is selected, the boxes shows perfectly. How can I rectify this?
Thank you
I have linked the main checkbox to cell G140. When ticking/unticking the checkbox, G140 turns to TRUE/FALSE, as it should.
The problem is the boxes are not showing until I enter a random value in a random cell. I think it has to do with the VBA code not running when a checkbox is checked, but only when the sheet information changes. Here is the code I'm using:
VBA Code:
If ActiveSheet.Range("G140").Value = True Then
ActiveSheet.Shapes("Risk_Auditing").Visible = True
ActiveSheet.Shapes("Risk_CFO").Visible = True
ActiveSheet.Shapes("Risk_Committee").Visible = True
ActiveSheet.Shapes("Risk_Community_Director").Visible = True
ActiveSheet.Shapes("Risk_Councillors").Visible = True
ActiveSheet.Shapes("Risk_Emergency").Visible = True
ActiveSheet.Shapes("Risk_Environment").Visible = True
ActiveSheet.Shapes("Risk_Expenditure").Visible = True
ActiveSheet.Shapes("Risk_BTO").Visible = True
ActiveSheet.Shapes("Risk_Financial").Visible = True
ActiveSheet.Shapes("Risk_HR").Visible = True
ActiveSheet.Shapes("Risk_IDP").Visible = True
ActiveSheet.Shapes("Risk_ICT").Visible = True
ActiveSheet.Shapes("Risk_LED").Visible = True
ActiveSheet.Shapes("Risk_Mun_Health").Visible = True
ActiveSheet.Shapes("Risk_MM").Visible = True
ActiveSheet.Shapes("Risk_Performance").Visible = True
ActiveSheet.Shapes("Risk_Revenue").Visible = True
ActiveSheet.Shapes("Risk_Risk").Visible = True
ActiveSheet.Shapes("Risk_Roads").Visible = True
ActiveSheet.Shapes("Risk_SCM").Visible = True
Else
ActiveSheet.Shapes("Risk_Auditing").Visible = False
ActiveSheet.Shapes("Risk_CFO").Visible = False
ActiveSheet.Shapes("Risk_Committee").Visible = False
ActiveSheet.Shapes("Risk_Community_Director").Visible = False
ActiveSheet.Shapes("Risk_Councillors").Visible = False
ActiveSheet.Shapes("Risk_Emergency").Visible = False
ActiveSheet.Shapes("Risk_Environment").Visible = False
ActiveSheet.Shapes("Risk_Expenditure").Visible = False
ActiveSheet.Shapes("Risk_BTO").Visible = False
ActiveSheet.Shapes("Risk_Financial").Visible = False
ActiveSheet.Shapes("Risk_HR").Visible = False
ActiveSheet.Shapes("Risk_IDP").Visible = False
ActiveSheet.Shapes("Risk_ICT").Visible = False
ActiveSheet.Shapes("Risk_LED").Visible = False
ActiveSheet.Shapes("Risk_Mun_Health").Visible = False
ActiveSheet.Shapes("Risk_MM").Visible = False
ActiveSheet.Shapes("Risk_Performance").Visible = False
ActiveSheet.Shapes("Risk_Revenue").Visible = False
ActiveSheet.Shapes("Risk_Risk").Visible = False
ActiveSheet.Shapes("Risk_Roads").Visible = False
ActiveSheet.Shapes("Risk_SCM").Visible = False
End If
I have used similar code (only the shape names are different) in other instances where it is linked to a dropdown menu containing "yes" or "no". If yes is selected, the boxes shows perfectly. How can I rectify this?
Thank you