1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Excel checkboxes

Discussion in 'Software Development' started by VanHelsing, Nov 3, 2009.

Thread Status:
Not open for further replies.
Advertisement
  1. VanHelsing

    VanHelsing Thread Starter

    Joined:
    Nov 3, 2009
    Messages:
    5
    Hi,

    I'd lie a little help please regarding Excel 2007 checkboxes. I have 3 of them but I only need one to be checked at a time. Can it be done with VBA automatically?

    Thank you in advance.
     
  2. OBP

    OBP It's My Birthday!

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    VanHelsing, welcome to the Forum.
    You usually get a quicker and better response to Excel/Access/Word questions if you post on the Business Applications Forum.
    But to get back to your question, each Checkbox will need VBA like this one for Checkbox1, I am sure that you can work out the other two.

    Private Sub CheckBox1_Click()
    If CheckBox1 = -1 Then
    CheckBox2 = 0
    CheckBox3 = 0
    End If
    End Sub
     
  3. wedonttakecrap

    wedonttakecrap

    Joined:
    Nov 3, 2009
    Messages:
    7
    Hello VanHelsing,

    I was wondering why, in this instance, you were using checkboxes instead of a Option (radio) button group? Option buttons only allow one choice to be selected, and saves tedious programming.

    A friendly bit of advice to any who may read this: For simple applications of checkboxes and radio buttons, be sure to use the Form Controls from "Developer > Controls > Insert" on the ribbon. It not only saves programming time, but they are not blocked by macro security settings.

    happy hacking.
     
  4. VanHelsing

    VanHelsing Thread Starter

    Joined:
    Nov 3, 2009
    Messages:
    5
    Thank you both very much, I got my question answered :)
    But I have another one: Using radio buttons is excellent but I have 3 different sections, each containing 3 radio buttons and I need those 3 sections to be selected independently.
     
  5. wedonttakecrap

    wedonttakecrap

    Joined:
    Nov 3, 2009
    Messages:
    7
    First, place a group control. Then place your radio buttons inside the borders of the group control. It's ridiculously easy in 2007, but not terribly intuitive.

    The radio buttons will only interact with the other ones in the control borders

    Cheers.
     
  6. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/874087

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice