Checkbox Help in Excel?

Hi All!

I am working on a sheet in excel titled "Budget Worksheet" that currently has a checkbox linked to cell A1. I need for the checkbox to become disabled or unchecked if cell F25 is blank (NOT 0... must be blank). I have never done a VBA before and do not know where to start with that so if that is the only solution please tell me step by step how to get there. I do not know what the name of the checkbox is because when I open properties it doesn't say but it was created using form controls under the developers tab. I'm using office 2007. Your help is greatly appreciated!!

Update:

Hi there,

I tried your suggestion but it didn't work. I made a mistake with the version office I'm using. I am using Office 2010, not 2007. Not sure if that makes a difference. I also replaced the checkbox with a new one and found the name "Check Box 63". Any ideas? There are multiple check boxes in the sheet. I just need this one to disable when F25 is blank. Thank you for your help!

Update 2:

I finally was able to get it to work however it is still showing the check mark. The vaue in cell A1 changes to false however the checkmark is still there. Is there any way to make the checkmark disapear too?

If there is anything in cell F25 the user should be able to check and uncheck the box as they wish so I used the first code you displayed in your second answer. Thank you so much!! You have no idea how much of a savior you are if this works! :). Please let me know if you have any suggestions.

Update 3:

CORRECTION:

My apologies but it didn't work :(. I replaced the check box with check box 67 and forgot to assign it to a cell. I changed the number in your code from 63 to 67 and it still didn't work. I have no idea what I am doing wrong. I followed your instructions perfectly. Can I email you the workbook?

2 Answers

Relevance
  • 8 years ago
    Favorite Answer

    Edit: The event handler previously posted functioned appropriately for me, when tested prior to posting. It was created in Excel 2010. However, since you now know the checkbox number, here are two replacement event handlers. The first will only trigger when the value of F25 becomes blank. The second will return the correct status based on the value of F25. If it is blank, it will be deselected. If not blank it will be selected.

    Copy this event handler to the clipboard (highlight the entire code, right click inside the highlighted area, and 'Copy'):

    Private Sub Worksheet_Change(ByVal Target As Range)

    If Range("F25").Value = "" Then

    ActiveSheet.CheckBoxes("Check Box 63").Value = False

    End If

    End Sub

    Select the worksheet containing the data you wish to evaluate and right click the sheet tab at the bottom.

    Select 'View Code'.

    Paste the event handler into the white editing area to the right (right click inside the area and 'Paste').

    Close the VBE (red button w/white 'x', top right).

    ----------------------------

    Now, if you also want the check box to automatically be checked if cell F25 is not blank, use this event handler instead, following the same procedure above:

    Private Sub Worksheet_Change(ByVal Target As Range)

    If Range("F25").Value = "" Then

    ActiveSheet.CheckBoxes("Check Box 63").Value = False

    End If

    If Range("F25").Value <> "" Then

    ActiveSheet.CheckBoxes("Check Box 63").Value = True

    End If

    End Sub

    Note: again, these have been tested in Excel 2010 and function as intended. Advise if you continue to experience difficulty.

  • 4 years ago

    suitable click on the checkbox click on the "format administration" choose the residences tab - interior the object Positioning, "do no longer circulate or length with cells" could desire to have been chosen. verify the two of the different 2 techniques which says "circulate and length with cells" or "circulate and don't length with cells".. whichever you want. enable me be responsive to if this helps. Round2: Which version of excel or workplace are you using?

Still have questions? Get your answers by asking now.