locking a button

G

Guest

Guest
I have created a button to take me to anoher sheet, however I only want the button to become active once the value within a cell satisfys certain criteria,ie <>0
Help appreciated cos holding up college assignment!!
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
I have created a button to take me to anoher sheet, however I only want the button to become active once the value within a cell satisfys certain criteria,ie <>0
Help appreciated cos holding up college assignment!!

Hi,

Are you using the button from View, Toolbars, Forms or View, Toolbars, Control Toolbox? If you're using the second type then doing what you want is fairly easy...

Right click the worksheet tab and choose View Code. Then try something like this:-

Code:
Private Sub Worksheet_Calculate()
CheckA1
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
CheckA1
End Sub

Sub CheckA1()
If Range("A1") <> 0 Then
    Me.CommandButton1.Enabled = True
Else
    Me.CommandButton1.Enabled = False
End If
End Sub

You'll have to change the name of your command button to match the name of yours.

HTH,
D
 
Upvote 0

Forum statistics

Threads
1,214,635
Messages
6,120,660
Members
448,975
Latest member
sweeberry

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