+ Reply to Thread
Results 1 to 8 of 8

WorkBook Open Event?

  1. #1
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    WorkBook Open Event?

    Good Morning All
    Not sure how to do this,when I open my workbook I want it to default a value in a CheckBox. I have two Checkboxes on sheet2,when I open
    the workbook I want checkbox 1 checked if there is no text in cell C15. When I open the workbook and there is text in cell C15 then checkbox2 has a check in it. Is there a way so both checkboxes can't be checked at the same time.
    Thanks Z
    Last edited by zplugger; 12-06-2011 at 11:51 AM.

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: WorkBook Open Event?

    Generally you'd use radio buttons if you only want one checked at once, on that assumption (and that you are using Forms Controls rather than ActiveX), there are two options as below. You can either set the option buttons manually or change the linked cell and they will update automatically:
    Please Login or Register  to view this content.

  3. #3
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: WorkBook Open Event?

    Hi Z,

    See the attached file.

    Feel free to get back in case of any questions.

    Regards,
    DILIPandey
    Attached Files Attached Files
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  4. #4
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: WorkBook Open Event?

    Hi Z,

    I have included a sample worksheet having your scenario along with the workbook open code.
    Try testing the same and let me know in case you have any questions.

    Note:- Checkboxes have been created using control toolbox.

    Regards,
    DILIPandey
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    Re: WorkBook Open Event?

    Thanks Dilipandey, works Great
    Just trying to understand how you did it si I can learn more.
    If Range("c15").Value = "" Then
    Range("A1").Value = True
    Else
    Range("A1").Value = False
    End If

    If Range("c15").Value <> "" Then
    Range("A2").Value = True
    Else
    Range("A2").Value = False
    End If
    How did you change checkbox1 to range1?

  6. #6
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: WorkBook Open Event?

    You are welcome Z,

    Below is the explanation for code:-

    Cell A1 is linked to Checkbox 1 and Cell A2 is linked to Checkbox 2.
    If A1 = True,, then Checkbox1 will be checked automatically and if A2 = True, then Checkbox2 will be checked.

    Now come to code, it is saying that if cell C15 ="" means if cell C15 is blank then A1 value will be TRUE, which will force Checkbox 1 to be checked else vice versa.. and rest code is self explanatory.

    I hope this helps.

    Regards,
    DILIPandey

  7. #7
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    Re: WorkBook Open Event?

    Thanks again DILIPandey for explaining the code, never to old to learn something. The problem is to remember what you learn. LOL. I think
    Kyle123 had a good idea about radio buttions too.
    Thanks again Guys
    Z

  8. #8
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: WorkBook Open Event?

    You are welcome Z. Thanks.

    Cheers

    Regards,
    DILIPandey

+ 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