Active X Button Disabled based on Another Cell Condition

hkelly393

New Member
Joined
Jun 25, 2019
Messages
13
I need to enable CommandButton1 when Cell CY13 is equal to Yes. The problem is my formula is based on CountA, which I thought was going to work. Even a cell with a formula in it will trigger the button to be turned on. How can I get the following to focus on the actual value of Cell CY13 (which will have a formula to determine its value which will be either Yes or No). I don't want a range like it shows below but rather If CY13=Yes then CommandButton1 is enabled.


Private Sub Worksheet_Change(ByVal Target As Range)
CommandButton1.Enabled = False
If Application.WorksheetFunction.CountA(Range("CY:CY")) > 0 Then
CommandButton1.Enabled = True
End If

End Sub
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Try this:
VBA Code:
Private Sub Worksheet_Calculate()
 CommandButton1.Enabled = Range("CY13").Value = "Yes" 
End Sub
 
Upvote 0
Unfortunately that did not work for me. CommandButton1 remains disabled despite meeting the condition.
 
Upvote 0
What is the formula in CY13?
 
Upvote 0

Forum statistics

Threads
1,214,858
Messages
6,121,960
Members
449,057
Latest member
FreeCricketId

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