Hiding checkboxes based on cell value

MissingInAction

Board Regular
Joined
Sep 20, 2019
Messages
85
Office Version
  1. 365
Platform
  1. Windows
Hi everyone.
I'm busy creating an application form where users would apply for network, phone, etc. access from the IT department. In an effort to make the form as simple as possible for users to understand, I'm making use of quite a few conditional formatting, data validations, etc.
My question is this. I have a question on the form asking if the user needs computer equipment. If the answer is yes (answer is in E37), I want checkboxes to be visible so that the user can select things like laptops, desktops, etc.
The first prize would be if I could do this without VBA code, but I doubt that is possible. I have tried the solution I found here: Hide Checkbox based on cell value but it did not work in my case. Here is the code I'm using, modified from the previously mentioned thread:
VBA Code:
Private Sub Equipment_Change()
    If ActiveSheet.Range("E37").Value = "Yes" Then
        ActiveSheet.Shapes("Equipment").Visible = False
    Else
        ActiveSheet.Shapes("Equipment").Visible = True
    End If
End Sub

I do have a checkbox on that sheet called "equipment". I have written "equipment" in the name box next to the formula bar. I assume this is the correct place. I have tried both the form control checkbox and the Active X checkbox (renaming both "equipment"), since I do not know what the difference is, apart from some of the right click options that changes.

Thank you
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
The namebox is for giving names to a cell!
You need to use a name like: ActiveSheet.Shapes("CheckBox1")
 
Upvote 0
Are you saying it will not accept that name if I type it in the namebox? When I view the source for the tick box, it opens VBA and shows the following:
VBA Code:
Sub Equipment_Click()

End Sub
I therefor assumed it accepted the name.
 
Upvote 0
You are right.
Maybe you can use an other event: Worksheet_Change

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If ActiveSheet.Range("E37").Value = "Yes" Then
            ActiveSheet.Shapes("Equipment").Visible = True
        Else
            ActiveSheet.Shapes("Equipment").Visible = False
    End If
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,214,967
Messages
6,122,503
Members
449,090
Latest member
RandomExceller01

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