# Looping Checkboxes on Worksheet

1. ## 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. ## 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" <Robbyn@discussions.microsoft.com> wrote in message
news:792C3EDE-A6D4-4D9F-A84E-D7D40D979426@microsoft.com...
> 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. ## 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" <Robbyn@discussions.microsoft.com> wrote in message
> news:792C3EDE-A6D4-4D9F-A84E-D7D40D979426@microsoft.com...
> > 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
> >

>
>
>

#### Thread Information

##### Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### 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