+ Reply to Thread
Results 1 to 10 of 10

Form Control CheckBox check/uncheck via code

  1. #1
    Registered User
    Join Date
    03-01-2013
    Location
    Florida
    MS-Off Ver
    Excel 2010
    Posts
    43

    Form Control CheckBox check/uncheck via code

    Hi,

    I am trying to figure out how to check/uncheck a form control checkbox through code based upon the true/false result of another checkbox, but cant seem to get it. I am not sure if it is possible. The following codes are the two (of many) tries. Can anyone tell me what I am doing wrong?

    Please Login or Register  to view this content.
    and..........

    Please Login or Register  to view this content.
    I have tried many others, for example ws.Range ("BI9").Value = True........or "True" to no avail.

    I would appreciate any help.

    Thank you,
    JasonRay

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Form Control CheckBox check/uncheck via code

    Something like this:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524

    Re: Form Control CheckBox check/uncheck via code

    Looking at your codes,I see that they do not match.
    Possibly,
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    03-01-2013
    Location
    Florida
    MS-Off Ver
    Excel 2010
    Posts
    43

    Re: Form Control CheckBox check/uncheck via code

    xladept,
    Cant a code for just the one checkbox I want to affect by code suffice? I mean, after all one of the checkboxes is already doing what I want - returning a TRUE/FALSE answer. Its just that I want that TRUE/FALSE answer to automatically affect the other checkbox. I hope I didn't confuse the question by posting two codes that were only attempts at the same thing for the same checkbox. If so, and if one code for one checkbox will work, let me simplify (for myself really) what I want the one code to do.
    In this example CheckBox1 is taken care of by the user checking the box or unchecking the box. So the following is what I have tried for CheckBox2 so that it will be affected by CheckBox1;
    Please Login or Register  to view this content.
    Please excuse my ignorance, if your original answer already answered the question. I tried long and hard before I came to the conclusion that I must have confused the question, possible an incorrect conclusion.
    Thanks for your patience and assistance.

    JasonRay
    Last edited by JasonRay; 04-17-2013 at 10:35 PM.

  5. #5
    Registered User
    Join Date
    03-01-2013
    Location
    Florida
    MS-Off Ver
    Excel 2010
    Posts
    43

    Re: Form Control CheckBox check/uncheck via code

    DavesExcel,
    They are two attempts at the same thing. I just made a rule for posting - never post two examples of code when asking for advice for a single issue. Sorry all.
    The following is what I was attempting;

    Please Login or Register  to view this content.
    If that makes anymore sense I would be very grateful for any advice you or anyone else could give me.

    Thank you ,
    JasonRay

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Form Control CheckBox check/uncheck via code

    Hi Jason,

    Did you try my code - it works nicely - unless I don't understand the problem?

  7. #7
    Registered User
    Join Date
    03-01-2013
    Location
    Florida
    MS-Off Ver
    Excel 2010
    Posts
    43

    Re: Form Control CheckBox check/uncheck via code

    xladept,
    I tried it a million times with 10 million variations and couldn't get it to work, but that was last night.
    Evidently I was punchy as upon retry today it worked almost how I wanted it to.

    Thank you much for your help.

    Solved.

    JasonRay

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Form Control CheckBox check/uncheck via code

    You're welcome! Almost???

  9. #9
    Registered User
    Join Date
    03-01-2013
    Location
    Florida
    MS-Off Ver
    Excel 2010
    Posts
    43

    Re: Form Control CheckBox check/uncheck via code

    Almost because I was looking to get checkbox1 to affect checkbox2 with no user intervention in checkbox2 (which your code accomplishes) but not vice versa. So with your code if the user checks checkbox2 it also affects checkbox1, which is what I did not want to happen. But that is ok, because you have led me down the trail whereby I think I can figure it out myself, which is part of the learning experience. I still thank you as you removed a brain road block and I can now tarry forth in the dark forest myself. (until I encounter another road block and ask for rescue from this life-saving forum, that is). lol.

    Thanks again.
    JasonRay

  10. #10
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Form Control CheckBox check/uncheck via code

    Up pup and AWAAAAAAY!

+ 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