Can I hide/unhide a Checkbox based on cell in another sheet's value?

c.clavin

Board Regular
Joined
Mar 22, 2011
Messages
123
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hi guys, Ive been Googling for VB code that will allow me to do this, but I'm not having any success. The cell I'm trying to base my box hiding/unhiding is X74 in Sheet1 and the checkbox is Checkbox27 (does that make a difference?) its the only checkbox on the page. This VB/Macro stuff is way over my head. Thank you!
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Hide/unhide based on what, exactly? No data vs data? >45? =55? etc.
 
Upvote 0
If it contains the word “both”. Sorry, I should have added that
 
Upvote 0
perhaps worksheet change event. This is "air code" (from my head and untested):

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)

If Not Intersect(Target, Range("$X$74")) Is Nothing Then
   Shapes("Checkbox27").Visible = Ucase(Range("X74")) = "BOTH"
End If

End Sub
 
Upvote 0
It doesn't seem to be working, the X74 cell is on Sheet1. Does that mean I need to refer to it as Sheets(Sheet1)?
 
Upvote 0
If you put the code in the module for the sheet you want it to work on, you shouldn't need that. Won't hurt to reference the sheet name though. If you put similar code in a a standard module, then it's not an option. However, sheet change event code needs to be in the sheet module. It won't work in a standard module AFAIK. So "not working" doesn't help much. What happens? Nothing? Error message? Something else? Where did you put that example code?
 
Upvote 0

Forum statistics

Threads
1,216,761
Messages
6,132,570
Members
449,736
Latest member
anthx

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