I want put a lot of checkBoxs, SpinButtons... on a Sheet.
In VBA project, how I get these CheckBoxs state by its name?
Thanks.
I want put a lot of checkBoxs, SpinButtons... on a Sheet.
In VBA project, how I get these CheckBoxs state by its name?
Thanks.
Cactus
Sub findCheckBoxState()
Dim chkState As Boolean
chkState = ActiveSheet.OLEObjects("Checkbox1").Object.Value
MsgBox chkState
End Sub
--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
nick_hodgeTAKETHISOUT@zen.co.uk.ANDTHIS
"Cactus [ÏÉÈËÇò]" <a@b.com> wrote in message
news:%23Z5YkDG%23EHA.3988@TK2MSFTNGP11.phx.gbl...
>I want put a lot of checkBoxs, SpinButtons... on a Sheet.
>
> In VBA project, how I get these CheckBoxs state by its name?
>
> Thanks.
Nick Hodge
The example can't work in my Excel 2000.
Sub Main()
i = 2
Sheet1.Range("A1").Value = "Name"
Sheet1.Range("B1").Value = "Link Type"
For Each obj In Worksheets("sheet1").OLEObjects
'In track, never go to here. I put a few CheckBox's on Sheet1.
Sheet1.Cells(i, 1) = obj.Name
If obj.OLEType = xlOLELink Then
Sheet1.Cells(i, 2) = "Linked"
Else
Sheet1.Cells(i, 2) = "Embedded"
End If
i = i + 1
Next
End Sub
> Cactus
>
> Sub findCheckBoxState()
> Dim chkState As Boolean
> chkState = ActiveSheet.OLEObjects("Checkbox1").Object.Value
> MsgBox chkState
> End Sub
>
> --
> HTH
> Nick Hodge
> Microsoft MVP - Excel
> Southampton, England
> nick_hodgeTAKETHISOUT@zen.co.uk.ANDTHIS
>
>
> "Cactus [ÏÉÈËÇò]" <a@b.com> wrote in message
> news:%23Z5YkDG%23EHA.3988@TK2MSFTNGP11.phx.gbl...
> >I want put a lot of checkBoxs, SpinButtons... on a Sheet.
> >
> > In VBA project, how I get these CheckBoxs state by its name?
> >
> > Thanks.
>
>
Are you using controls from the Controls toolbar or the Forms
toolbar?
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
"Cactus [ÏÉÈËÇò]" <a@b.com> wrote in message
news:%23wORUzT%23EHA.608@TK2MSFTNGP15.phx.gbl...
>
> Nick Hodge
>
> The example can't work in my Excel 2000.
>
>
>
> Sub Main()
>
>
> i = 2
> Sheet1.Range("A1").Value = "Name"
> Sheet1.Range("B1").Value = "Link Type"
> For Each obj In Worksheets("sheet1").OLEObjects
>
> 'In track, never go to here. I put a few CheckBox's on
> Sheet1.
> Sheet1.Cells(i, 1) = obj.Name
> If obj.OLEType = xlOLELink Then
> Sheet1.Cells(i, 2) = "Linked"
> Else
> Sheet1.Cells(i, 2) = "Embedded"
> End If
> i = i + 1
> Next
>
> End Sub
>
>
>
>
>> Cactus
>>
>> Sub findCheckBoxState()
>> Dim chkState As Boolean
>> chkState = ActiveSheet.OLEObjects("Checkbox1").Object.Value
>> MsgBox chkState
>> End Sub
>>
>> --
>> HTH
>> Nick Hodge
>> Microsoft MVP - Excel
>> Southampton, England
>> nick_hodgeTAKETHISOUT@zen.co.uk.ANDTHIS
>>
>>
>> "Cactus [ÏÉÈËÇò]" <a@b.com> wrote in message
>> news:%23Z5YkDG%23EHA.3988@TK2MSFTNGP11.phx.gbl...
>> >I want put a lot of checkBoxs, SpinButtons... on a Sheet.
>> >
>> > In VBA project, how I get these CheckBoxs state by its name?
>> >
>> > Thanks.
>>
>>
>
Chip Pearson
I mistake the two controls toolbar.
Thanks.
> Are you using controls from the Controls toolbar or the Forms
> toolbar?
>
>
> --
> Cordially,
> Chip Pearson
> Microsoft MVP - Excel
> Pearson Software Consulting, LLC
> www.cpearson.com
>
>
Does that mean you used the checkbox from the Forms toolbar?
If yes,
Option Explicit
Sub testme()
If ActiveSheet.CheckBoxes("check box 1").Value = xlOn Then
MsgBox "It's checked"
Else
MsgBox "it's not checked"
End If
End Sub
Cactus [ÏÉÈËÇò] wrote:
>
> Chip Pearson
>
> I mistake the two controls toolbar.
>
> Thanks.
>
> > Are you using controls from the Controls toolbar or the Forms
> > toolbar?
> >
> >
> > --
> > Cordially,
> > Chip Pearson
> > Microsoft MVP - Excel
> > Pearson Software Consulting, LLC
> > www.cpearson.com
> >
> >
--
Dave Peterson
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks