+ Reply to Thread
Results 1 to 3 of 3

Looping Checkboxes on Worksheet

  1. #1
    Robbyn
    Guest

    Looping Checkboxes on Worksheet

    Yet another annoying question..(thanks again Norman for helping me get started)

    I have a series of checkboxes (from control toolbox) on a worksheet and need
    to pass the values to another worksheet("Data"). The problem I'm having with
    the following code is if the value of the checkbox is false the corresponding
    cell in "Data" needs to be blank; instead, if there is a total of 6
    checkboxes checked , the first 6 cells in "Data" are marked as true.

    n = 43
    For Each OLEObj In sh.OLEObjects
    If TypeOf OLEObj.Object Is MSForms.CheckBox Then
    If OLEObj.Object.Value Then
    n = n + 1
    rng.Offset(0, n).Value = Chr(82)
    End If
    End If
    Next OLEObj


  2. #2
    Tom Ogilvy
    Guest

    Re: Looping Checkboxes on Worksheet

    n = 43
    For Each OLEObj In sh.OLEObjects
    If TypeOf OLEObj.Object Is MSForms.CheckBox Then
    n = n + 1
    If OLEObj.Object.Value Then
    rng.Offset(0, n).Value = Chr(82)
    End If
    End If
    Next OLEObj


    --
    Regards,
    Tom Ogilvy

    "Robbyn" <[email protected]> wrote in message
    news:[email protected]...
    > Yet another annoying question..(thanks again Norman for helping me get

    started)
    >
    > I have a series of checkboxes (from control toolbox) on a worksheet and

    need
    > to pass the values to another worksheet("Data"). The problem I'm having

    with
    > the following code is if the value of the checkbox is false the

    corresponding
    > cell in "Data" needs to be blank; instead, if there is a total of 6
    > checkboxes checked , the first 6 cells in "Data" are marked as true.
    >
    > n = 43
    > For Each OLEObj In sh.OLEObjects
    > If TypeOf OLEObj.Object Is MSForms.CheckBox Then
    > If OLEObj.Object.Value Then
    > n = n + 1
    > rng.Offset(0, n).Value = Chr(82)
    > End If
    > End If
    > Next OLEObj
    >




  3. #3
    Robbyn
    Guest

    Re: Looping Checkboxes on Worksheet

    Grrrr..thanks Tom. I should have seen that.

    "Tom Ogilvy" wrote:

    > n = 43
    > For Each OLEObj In sh.OLEObjects
    > If TypeOf OLEObj.Object Is MSForms.CheckBox Then
    > n = n + 1
    > If OLEObj.Object.Value Then
    > rng.Offset(0, n).Value = Chr(82)
    > End If
    > End If
    > Next OLEObj
    >
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    > "Robbyn" <[email protected]> wrote in message
    > news:[email protected]...
    > > Yet another annoying question..(thanks again Norman for helping me get

    > started)
    > >
    > > I have a series of checkboxes (from control toolbox) on a worksheet and

    > need
    > > to pass the values to another worksheet("Data"). The problem I'm having

    > with
    > > the following code is if the value of the checkbox is false the

    > corresponding
    > > cell in "Data" needs to be blank; instead, if there is a total of 6
    > > checkboxes checked , the first 6 cells in "Data" are marked as true.
    > >
    > > n = 43
    > > For Each OLEObj In sh.OLEObjects
    > > If TypeOf OLEObj.Object Is MSForms.CheckBox Then
    > > If OLEObj.Object.Value Then
    > > n = n + 1
    > > rng.Offset(0, n).Value = Chr(82)
    > > End If
    > > End If
    > > Next OLEObj
    > >

    >
    >
    >


+ 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