Results 1 to 8 of 8
  1. #1
    4 Star Lounger
    Join Date
    May 2004
    Location
    Toronto, Ontario, Canada
    Posts
    425
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Checkbox (Excel 97)

    Hi all!

    I have a group of checkboxs on a Userform, within a frame. What I would like to know, is it possible to group these boxes?

    If checkbox1.value=true then
    Label1.caption= ""
    elseif checkbox2.value = true then
    Label1.caption= true then
    elseif checkbox3.value = true then
    and so on
    I get the first one to work, but the others won't input into the label.caption

    Thanks in Advance.

    Darryl.

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Checkbox (Excel 97)

    Not sure exactly what you are after.

    I am "guessing" that you don't want if .. elseif, as these are "mutually exclusive": You only do one of them, if checkbox1 is true it never looks at the other ones.

    Is this what you are after:
    If checkbox1.value=true then _
    Label1.caption= ""
    if checkbox2.value = true then _
    Label1.caption= true
    if checkbox3.value = true then _
    and so on

    Each one is a different IF statement so each are checked. This scheme allows more than one to be checked. Your scheme only checks for 1 of them.

    Or perhaps are you after "radio buttons" (only 1 can be selected)
    Steve

  3. #3
    4 Star Lounger
    Join Date
    May 2004
    Location
    Toronto, Ontario, Canada
    Posts
    425
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Re: Checkbox (Excel 97)

    Thanks, you are right, a radial option would work better<img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    <img src=/S/coffeetime.gif border=0 alt=coffeetime width=32 height=48>

  4. #4
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Checkbox (Excel 97)

    In addition to what Steve said, what is this statement supposed to do?

    <pre> Label1.caption= true
    </pre>


    Captions are normally set to text values. True and False are boolean values which will actually set the caption to zero or minus one. Is that what you want to do?
    Legare Coleman

  5. #5
    4 Star Lounger
    Join Date
    May 2004
    Location
    Toronto, Ontario, Canada
    Posts
    425
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Re: Checkbox (Excel 97)

    You are right, and thanks for your input,

    I did however solve the problem by using a combobox,

    I created a single vector array, then used it with comobox,

    Now that I learned how to create an array, anyone know how to make it multi-dimensional?

  6. #6
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Checkbox (Excel 97)

    <pre>Dim sArray(1 to 5,1 to 10) as string</pre>


    will create a string array (named sArray) that is 5 "rows" and 10 "columns"

    If you need more specifics you need to ask a more specific question

    Steve

  7. #7
    4 Star Lounger
    Join Date
    May 2004
    Location
    Toronto, Ontario, Canada
    Posts
    425
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Re: Checkbox (Excel 97)

    Steve,

    Thanks, you're right, call me a newbie to VBA, didn't even know it existed until I accidently pressed alt-F11, while working in a spreedsheet one day!

    Thanks for the Multi-dim array!

    Darryl

  8. #8
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Checkbox (Excel 97)

    That is only 2 dimensional, you can of course have more:
    Dim iArray(1 to 5, 1 to 10, 1 to 20) as Integer

    as an example of a 3-D array. It depends on what you need.

    Steve

Posting Permissions

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