+ Reply to Thread
Results 1 to 6 of 6

Uncheck a Check Box using VBA

  1. #1
    Registered User
    Join Date
    07-26-2011
    Location
    melbourne
    MS-Off Ver
    Excel 2010
    Posts
    40

    Uncheck a Check Box using VBA

    Hi
    I have a code which I am trying to use to uncheck a check box but keep getting the error "Unable to get the CheckBoxes property of Worksheet class"

    Can anyone help?

    Please Login or Register  to view this content.
    Last edited by ashmott; 09-01-2011 at 10:29 PM.

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Uncheck a Check Box using VBA

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-01-2011
    Location
    Seattle, USA
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Uncheck a Check Box using VBA

    Try Sheets("Sheet1").CheckBoxes.Item("CheckBox1").Value = False

    It looks like you left off the Item argument of the Checkboxes collection.

    --Nickvans

  4. #4
    Registered User
    Join Date
    07-26-2011
    Location
    melbourne
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: Uncheck a Check Box using VBA

    Thanks guys but im still getting an error.
    I have attached my workbook if yoh have a chance to take a peek.
    Sorry for beng a noob.
    Attached Files Attached Files

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Uncheck a Check Box using VBA

    Hello ashmott,

    There were 2 problems with the code. One, the control being used is a Forms control.. You can not use False to uncheck a Forms control. You must use the Excel constant xlOff. Two, you had the control name wrong. It is "Check Box 1", not "CheckBox1". Here is the corrected and working code.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  6. #6
    Registered User
    Join Date
    07-26-2011
    Location
    melbourne
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: Uncheck a Check Box using VBA

    Thanks for your help Leith, much appreciated.

+ 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