Results 1 to 6 of 6
  1. #1
    chris.smith
    Guest

    XL97 - Checkbox reference in code?

    I have 'inherited' a spreadsheet that someone else has designed, and I need to create an extract based on entered data.

    All pretty straighforward stuff, except for two checkboxes. I have no idea how to reference the two checkboxes in VBA. And the help file isn't very helpful in this regard.

    The code suggested in the Microsoft Knowledgebase doesn't seem to want to work for me.

    Can someone please give me a hand with this ?

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: XL97 - Checkbox reference in code?

    Probably the best way to see how to reference the check boxes is to see how Excel references them. To do that set the macro recorder on and manipulate the check boxes, stop the recorder and examine the resultant macros. This assumes they are embedded in a worksheet and not part of a userform.

    If you need any further assistance, perhaps you could say exactly what you want to do with the check boxes.

    Andrew C

  3. #3
    chris.smith
    Guest

    Re: XL97 - Checkbox reference in code?

    I had tried the 'Record a Macro' before, but when you play with check boxes nothing shows up in the recorded macro.

    What I have done is to place a 'Cell link' in the Control (Format) and now I have a cell being populated that I can reference.

    Not elegant, but it is a way for me to get at the value in the checkbox.

    What I need to do is if the box is checked, I need to export an 'X' onto a pre-printed form. The checkbox was just a nice user-interface thing. The user liked it. Now I just have to get the data out of it!

  4. #4
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: XL97 - Checkbox reference in code?

    Sorry Chris, I thought you wanted to refer to the actual checkbox itself in VBA. If you record creating, moving or deleting the check box, the macro recorder should record those actions.

    However, as the value of the cell link gives you what you want, I assume the problem is resolved.

    Andrew

  5. #5
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: XL97 - Checkbox reference in code?

    Chris,

    I assume you mean checkboxes embedded in a form.

    The checkbox will be named. You can check the name by going into design mode (the set square icon on the Control toolbox), right clicking on the control, and selecting properties.

    I have a checkbox I've named "cbxMyBox". I can reference its values by "cbxMyBox.Value"- the possible values are True or False.
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  6. #6
    chris.smith
    Guest

    Re: XL97 - Checkbox reference in code?

    Unfortunately, no.

    This is just a checkbox drawn on a regular spreadsheet.

    The solution I mentioned previously is working, though.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •