locking a button
Prep for a pre-employment Excel test with Job Test Prep
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: locking a button

  1. #1
    Guest

    Default

     
    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!!

  2. #2
    Guest

    Default

      
    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

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com