Results 1 to 2 of 2

Thread: [RESOLVED] MS Excel 2007, Disable/Enable Checkboxes based upon cell value

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2012
    Location
    Long Island, NY
    Posts
    8

    Resolved [RESOLVED] MS Excel 2007, Disable/Enable Checkboxes based upon cell value

    I am trying to make it so when cell F15 (which has a list data validation) is set to "Off", that checkboxes 19, 20 and 21 are disabled. When F15 is on anything else, the boxes are enabled. My code is below.

    It disables it always, regardless of the value.

    I have a feeling it is what i named my sub as, but I am relatively new to VBA and cannot find how to appropriately name it. Any help would be appreciated. Thanks!

    Code:
    Sub Worksheet_Activate()
    If (Sheets("Generator").Range("F15").Value = "Off") Then
    Sheets("Generator").CheckBoxes("Check Box 19").Enabled = False
    Sheets("Generator").CheckBoxes("Check Box 20").Enabled = False
    Sheets("Generator").CheckBoxes("Check Box 21").Enabled = False
    Else
    Sheets("Generator").CheckBoxes("Check Box 19").Enabled = True
    Sheets("Generator").CheckBoxes("Check Box 20").Enabled = True
    Sheets("Generator").CheckBoxes("Check Box 21").Enabled = True
    End If
    End Sub

  2. #2

    Thread Starter
    New Member
    Join Date
    Oct 2012
    Location
    Long Island, NY
    Posts
    8

    Resolved Re: MS Excel 2007, Disable/Enable Checkboxes based upon cell value

    I resolved this one myself. IF anyone is intersted in the code here it is:
    Code:
    Private Sub Worksheet_Change(ByVal Target As Range)
        Dim KeyCells As Range
          Set KeyCells = Range("F15")
            If Not Application.Intersect(KeyCells, Range(Target.Address)) = "Off" Then
    Sheets("Generator").CheckBoxes("Check Box 19").Enabled = True
    Sheets("Generator").CheckBoxes("Check Box 20").Enabled = True
    Sheets("Generator").CheckBoxes("Check Box 21").Enabled = True
          
                 Else
    Sheets("Generator").CheckBoxes("Check Box 19").Enabled = False
    Sheets("Generator").CheckBoxes("Check Box 20").Enabled = False
    Sheets("Generator").CheckBoxes("Check Box 21").Enabled = False
    
    
           
        End If
    End Sub

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width