+ Reply to Thread
Results 1 to 4 of 4

Checkbox State Defined in Macro

  1. #1
    Registered User
    Join Date
    12-12-2015
    Location
    Sun City, AZ
    MS-Off Ver
    2016
    Posts
    2

    Checkbox State Defined in Macro

    I want to define the state of a checkbox based on an If/Then test in a macro.
    If Sheets("Rnd " & RoundsFlown - 1 & "").Range("X49") > 0 Then
    Checkbox14 = True

    The statement in this macro has no effect. The command "Checkbox14 = True" works fine when the command is contained within the code defining the function of other checkboxes.

    I have tested the functionality of the command within a macro by writing a very simple macro consisting of nothing more than "Checkbox 14 = True" which the running of also has no effect.

    Please tell me what I am missing.

    IEQFDave

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Checkbox State Defined in Macro

    Try this. Change the sheet name to suit.

    Sheets("Sheet1").CheckBox14.Value = True
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    12-12-2015
    Location
    Sun City, AZ
    MS-Off Ver
    2016
    Posts
    2

    Re: Checkbox State Defined in Macro

    AlphaFrog, thanks.
    That was too easy. I'll try to come up with a harder one next time.

    I just needed to tell Excel what sheet to invoke the macro.
    Seems odd to me that Excel needed that specific direction since all the rest of the macro commands are invoked in the active sheet.

    Ultimately I used "ActiveSheet.Checkbox14 = True" (Do you think there is any problem leaving off the ".Value" portion of the code?)

    Dave

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Checkbox State Defined in Macro

    Quote Originally Posted by IEQFDave View Post

    Ultimately I used "ActiveSheet.Checkbox14 = True" (Do you think there is any problem leaving off the ".Value" portion of the code?)
    You're welcome.

    No problem omitting .Value in this case, and no real advantage either.

+ 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. Hiding static images based on state of checkbox...
    By MrDang001 in forum Excel General
    Replies: 1
    Last Post: 09-04-2014, 07:02 PM
  2. CheckBox state not passing to the sub - Please Help
    By kbbraman in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-11-2012, 12:27 PM
  3. [SOLVED] Have the state of a checkbox populate a field.
    By azland00123 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-05-2012, 04:15 PM
  4. get state of checkbox on worksheet
    By wotadude in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-15-2009, 04:05 PM
  5. State of Checkbox - Without Macro
    By RichardBerry in forum Excel General
    Replies: 2
    Last Post: 09-13-2007, 06:48 AM
  6. Retrieving the state of a checkbox (form type) from VB .NET?
    By moogleii in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-04-2005, 09:06 PM
  7. [SOLVED] How I get CheckBox state on a Sheet.
    By Cactus [ÏÉÈËÇ&ograv in forum Excel General
    Replies: 6
    Last Post: 01-14-2005, 11:07 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