+ Reply to Thread
Results 1 to 4 of 4

Checkboxes, AND, OR statements

  1. #1
    CraigRichardPhillips@gmail.com
    Guest

    Checkboxes, AND, OR statements

    This is kind of similar to my last post, but I'm working with AND
    statements again in VBA. I'm trying to enter a value into a cell only
    if 2 or more different check boxes are marked off. Although this is
    very very wrong, something like:

    If ckbCoast = True

    And

    If ckbSFR = True Then

    Range("A168").Value = "O"

    End If

    As another very incorrect example:

    If ckbCoast = True

    And

    If ckbSFR = True

    OR

    If ckbAdd = True Then

    Range("A168").Value = "O"

    End If

    Thanks for the help guys!


  2. #2
    Tom Ogilvy
    Guest

    RE: Checkboxes, AND, OR statements

    the following pseudo code may give some ideas.

    If ckbCoast = True And _
    ckbSFR = True Then

    Range("A168").Value = "O"

    End If

    If (ckbCoast = True And _
    ckbSFR = True) OR
    (ckbCoast = True And _
    ckbAdd = True) OR _
    (ckbSFR = True And _
    ckbAdd = True) Then

    Range("A168").Value = "O"
    End If

    if clng(ckbSFR) + clng(ckbADD) + _
    clng(ckbCoast) <= -2 then
    Range("A168").Value = "O"
    End if





    --
    Regards,
    Tom Ogilvy



    "CraigRichardPhillips@gmail.com" wrote:

    > This is kind of similar to my last post, but I'm working with AND
    > statements again in VBA. I'm trying to enter a value into a cell only
    > if 2 or more different check boxes are marked off. Although this is
    > very very wrong, something like:
    >
    > If ckbCoast = True
    >
    > And
    >
    > If ckbSFR = True Then
    >
    > Range("A168").Value = "O"
    >
    > End If
    >
    > As another very incorrect example:
    >
    > If ckbCoast = True
    >
    > And
    >
    > If ckbSFR = True
    >
    > OR
    >
    > If ckbAdd = True Then
    >
    > Range("A168").Value = "O"
    >
    > End If
    >
    > Thanks for the help guys!
    >
    >


  3. #3
    CraigRichardPhillips@gmail.com
    Guest

    Re: Checkboxes, AND, OR statements

    Thanks, this looks great. Also, is there a way to link the check boxes
    between 2 different user forms (say ckbCoast is in frmLocal and ckbSFR
    is in frmInfo)? Perhaps there's Hide Me function that would keep one
    user form open, just not shown on the screen giving the next form the
    ability to link back to it. Any ideas?


  4. #4
    Tom Ogilvy
    Guest

    Re: Checkboxes, AND, OR statements

    No link like a controlsource.

    You can link with code in events

    Userform1.cbox1.Value = Userform2.cbox3.Value

    Userform1.hide

    hides the userform but doesn't unload it so you can still access its
    controls (read from and write to)

    --
    Regards,
    Tom Ogilvy


    <CraigRichardPhillips@gmail.com> wrote in message
    news:1143586234.301709.50620@e56g2000cwe.googlegroups.com...
    > Thanks, this looks great. Also, is there a way to link the check boxes
    > between 2 different user forms (say ckbCoast is in frmLocal and ckbSFR
    > is in frmInfo)? Perhaps there's Hide Me function that would keep one
    > user form open, just not shown on the screen giving the next form the
    > ability to link back to it. Any ideas?
    >




+ 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