+ Reply to Thread
Results 1 to 7 of 7

Reference if Checkbox is checked on Worksheet_Change

  1. #1
    Registered User
    Join Date
    05-12-2010
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    42

    Reference if Checkbox is checked on Worksheet_Change

    Hey folks,

    I have another one for anyone willing to help.

    I have 4 checkboxes on a worksheet and I am trying to reference each to set off a warning if the checkbox is checked in the following manner:

    Please Login or Register  to view this content.
    The following gives me a run-time error - "Object doesn't support this property or method".

    Is there another way to reference whether the checkbox is checked or not? Is my code anywhere close?

    Thanks in advance.
    Last edited by LampCommandr; 04-11-2011 at 10:48 AM.

  2. #2
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,255

    Re: Reference if Checkbox is checked on Worksheet_Change

    Hi,

    If it's a Forms control checkbox, you can check it like this:
    Please Login or Register  to view this content.
    If it's an ActiveX control checkbox, you can check it like this:
    Please Login or Register  to view this content.
    Hope that helps,

    Colin

    RAD Excel Blog

  3. #3
    Registered User
    Join Date
    05-12-2010
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    42

    Re: Reference if Checkbox is checked on Worksheet_Change

    Thanks Colin, that is what I was looking for.

    Additionally, is there a Worksheet_Change equivalent for a checkbox? I am trying to apply the same checks when the user checks or unchecks the box.

    I tried including "CheckBox_Zone 1" as a worksheet target but I couldn't get it to recognize.

  4. #4
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,255

    Re: Reference if Checkbox is checked on Worksheet_Change

    Hi,

    You didn't clarify which type of checkbox it is, so I'll briefly answer for both of them.

    ActiveX control checkboxes do have a Change event handler. If the ActiveX control is on a worksheet then the Checkbox's Change event handler would live in that worksheet's class module.

    Forms control checkboxes do not have a Change event handler but you can assign a macro to them which will run when they are changed. Right click > Assign Macro.

  5. #5
    Registered User
    Join Date
    05-12-2010
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    42

    Re: Reference if Checkbox is checked on Worksheet_Change

    Sorry, I'm using a form control checkbox. It seems it might be easier to use an Active X control instead. Thanks for the quick response!

  6. #6
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,255

    Re: Reference if Checkbox is checked on Worksheet_Change

    Hi,

    Forms controls are more lightweight and therefore less buggy so, if you have to have a control on a worksheet, one generally prefers to use them rather than ActiveX for simple tasks.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    05-12-2010
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    42

    Re: Reference if Checkbox is checked on Worksheet_Change

    Thanks Colin, this is great!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1