+ Reply to Thread
Results 1 to 9 of 9

userform to refer to active X check boxes in excel

  1. #1
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    userform to refer to active X check boxes in excel

    i came across an interesting problem:
    I am trying to have a user form check an active X check box situated in excel, is this at all possible?
    For some reason the user form cannot access the check boxes, my hunch is that user forms have the possibility of having their own check boxes so maybe vba is getting confused?
    Any help would be greatly appreciated

  2. #2
    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: userform to refer to active X check boxes in excel

    Hello kosherboy,

    Without seeing the workbook layout and the code you are using, I can not tell you where the problem is.

    ActiveX controls placed on a Worksheet belong to the Worksheet as an OLEObject class. You must qualify your references to the ActiveX control using the worksheet's name.

    For Example, this will set CheckBox1 to True (Check visible)
    Please Login or Register  to view this content.
    Last edited by Leith Ross; 12-30-2015 at 06:50 PM.
    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!)

  3. #3
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: userform to refer to active X check boxes in excel

    It will work if you refer to the Sheet object by it's code name
    Please Login or Register  to view this content.
    Although if you are going to be sending this sheet to others, you might want to use Form controls on the worksheet, in case someone has a Mac.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  4. #4
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: userform to refer to active X check boxes in excel

    Quote Originally Posted by Leith Ross View Post
    Hello kosherboy,

    Without seeing the workbook layout and the code you are using, I can not tell you where the problem is.

    ActiveX controls placed on a Worksheet belong to the Worksheet as an OLEObject class. You must qualify your references to the ActiveX control using the worksheet's name.

    For Example, this will set CheckBox1 to True (Check visible)
    Please Login or Register  to view this content.
    Hi Leith,
    Thank you for your response.
    Here is an uploaded example workbook Book1.xlsm, your suggestion works if the action does not depend on "if" statement, please see in my uploaded workbook the following argument "If range G3.value = "TRUE" then have the userform check the active x checkbox", the code doen't seem to be reading this argument hence the checbox is not getting checked.

  5. #5
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: userform to refer to active X check boxes in excel

    Quote Originally Posted by mikerickson View Post
    It will work if you refer to the Sheet object by it's code name
    Please Login or Register  to view this content.
    Although if you are going to be sending this sheet to others, you might want to use Form controls on the worksheet, in case someone has a Mac.
    Thank you MikeRickson.
    I appreciate your time on this however my goal is to have the userform 'actively' check the activeX checkbox, the message boxes is definetly an interesting way of reading the checkbox but it does not help me in this situation.

  6. #6
    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: userform to refer to active X check boxes in excel

    Hello Kosherboy,

    The problem with is the syntax.

    Here is the corrected code. The correction is in blue.
    Please Login or Register  to view this content.

  7. #7
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: userform to refer to active X check boxes in excel

    Wow! So simple!
    Thanks

  8. #8
    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: userform to refer to active X check boxes in excel

    Hello kosherboy,

    The difference is "TRUE" is a String type while True is Boolean type. Excel capitalizes TRUE to indicate the value is Boolean but also treats any string value like TURE as a Boolean value.

    Hae a guid Hogmany.
    Have a good New Year's EVE.

    Bliadhna mhath ùr!
    Happy New Year!

  9. #9
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: userform to refer to active X check boxes in excel

    Thank you, that is definitely some helpful info.
    Happy New Year's to you as well!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Active X and Mac OS - check boxes
    By wpryan in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-01-2015, 08:19 AM
  2. [SOLVED] Using Check Boxes in a Userform
    By RaydenUK in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-11-2015, 11:19 PM
  3. [SOLVED] HELP, formula for selecting multiple active x check boxes
    By joe318e in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-24-2014, 09:46 PM
  4. [SOLVED] UserForm Auto Check check boxes if TextBoxes are not empies
    By MariaPap in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-12-2013, 11:36 AM
  5. [SOLVED] Dynamic Chart with Active X Check Boxes - Adding drilldown
    By jrvstl in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 09-10-2012, 02:43 PM
  6. Clearing check boxes in active sheet only
    By 2funny4words in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-27-2012, 12:13 PM
  7. Check Boxes in UserForm
    By mccrimmon in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-30-2008, 12:04 PM

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