Hi,
I have two pieces of code, a button and a checkbox.
I would like to be able to have the button operate one
piece of code should the checkbox be checked or another
piece of code if it is left unchecked.
how would i lay it out?
Lynda.
Hi,
I have two pieces of code, a button and a checkbox.
I would like to be able to have the button operate one
piece of code should the checkbox be checked or another
piece of code if it is left unchecked.
how would i lay it out?
Lynda.
Assuming controls from the Control Toolbox Toolbar, use the click event for
the commandbutton
Private Sub Commandbutton1_Click()
if me.Checkbox1.Value = True then
' some code
else
' some other code
end if
End Sub
Post back if from the forms toolbar.
--
Regards,
Tom Ogilvy
"Lynda" <[email protected]> wrote in message
news:[email protected]...
> Hi,
>
> I have two pieces of code, a button and a checkbox.
>
> I would like to be able to have the button operate one
> piece of code should the checkbox be checked or another
> piece of code if it is left unchecked.
>
> how would i lay it out?
>
> Lynda.
Tom
I had to use the following code to get it to work
If ActiveSheet.DrawingObjects("Check Box 9").Value < 1
Then
etc.. etc..
how can I get the checkbox to reset on exit of the form
to make its state as unticked even if the last thing I
have done is tick it?
lynda
>-----Original Message-----
>Assuming controls from the Control Toolbox Toolbar, use
the click event for
>the commandbutton
>Private Sub Commandbutton1_Click()
> if me.Checkbox1.Value = True then
> ' some code
> else
> ' some other code
> end if
>End Sub
>
>Post back if from the forms toolbar.
>
>--
>Regards,
>Tom Ogilvy
>
>
>"Lynda" <[email protected]> wrote in
message
>news:[email protected]...
>> Hi,
>>
>> I have two pieces of code, a button and a checkbox.
>>
>> I would like to be able to have the button operate one
>> piece of code should the checkbox be checked or another
>> piece of code if it is left unchecked.
>>
>> how would i lay it out?
>>
>> Lynda.
>
>
>.
>
If ActiveSheet.Checkboxes("Check Box 9").Value = xloff then ' or xlOn for
checked
How do you exit the form? (I assume by form you mean a worksheet that you
have laid out to look like a paper form).
I you mean select another sheet then perhaps right click on the sheet tab
and select view code. In the resulting code module Put in code like
Private Sub Worksheet_Deactivate()
Me.CheckBoxes("Check Box 9").Value = xlOff
End Sub
--
Regards,
Tom Ogilvy
"Lynda" <[email protected]> wrote in message
news:[email protected]...
> Tom
>
> I had to use the following code to get it to work
>
> If ActiveSheet.DrawingObjects("Check Box 9").Value < 1
> Then
> etc.. etc..
>
> how can I get the checkbox to reset on exit of the form
> to make its state as unticked even if the last thing I
> have done is tick it?
>
> lynda
>
> >-----Original Message-----
> >Assuming controls from the Control Toolbox Toolbar, use
> the click event for
> >the commandbutton
> >Private Sub Commandbutton1_Click()
> > if me.Checkbox1.Value = True then
> > ' some code
> > else
> > ' some other code
> > end if
> >End Sub
> >
> >Post back if from the forms toolbar.
> >
> >--
> >Regards,
> >Tom Ogilvy
> >
> >
> >"Lynda" <[email protected]> wrote in
> message
> >news:[email protected]...
> >> Hi,
> >>
> >> I have two pieces of code, a button and a checkbox.
> >>
> >> I would like to be able to have the button operate one
> >> piece of code should the checkbox be checked or another
> >> piece of code if it is left unchecked.
> >>
> >> how would i lay it out?
> >>
> >> Lynda.
> >
> >
> >.
> >
Thanks Tom,
Thats just what I needed.
L.
>-----Original Message-----
>If ActiveSheet.Checkboxes("Check Box 9").Value = xloff
then ' or xlOn for
>checked
>
>How do you exit the form? (I assume by form you mean a
worksheet that you
>have laid out to look like a paper form).
>
>I you mean select another sheet then perhaps right click
on the sheet tab
>and select view code. In the resulting code module Put
in code like
>
>Private Sub Worksheet_Deactivate()
>Me.CheckBoxes("Check Box 9").Value = xlOff
>End Sub
>
>
>--
>Regards,
>Tom Ogilvy
>
>"Lynda" <[email protected]> wrote in
message
>news:[email protected]...
>> Tom
>>
>> I had to use the following code to get it to work
>>
>> If ActiveSheet.DrawingObjects("Check Box 9").Value < 1
>> Then
>> etc.. etc..
>>
>> how can I get the checkbox to reset on exit of the form
>> to make its state as unticked even if the last thing I
>> have done is tick it?
>>
>> lynda
>>
>> >-----Original Message-----
>> >Assuming controls from the Control Toolbox Toolbar,
use
>> the click event for
>> >the commandbutton
>> >Private Sub Commandbutton1_Click()
>> > if me.Checkbox1.Value = True then
>> > ' some code
>> > else
>> > ' some other code
>> > end if
>> >End Sub
>> >
>> >Post back if from the forms toolbar.
>> >
>> >--
>> >Regards,
>> >Tom Ogilvy
>> >
>> >
>> >"Lynda" <[email protected]> wrote in
>> message
>> >news:[email protected]...
>> >> Hi,
>> >>
>> >> I have two pieces of code, a button and a checkbox.
>> >>
>> >> I would like to be able to have the button operate
one
>> >> piece of code should the checkbox be checked or
another
>> >> piece of code if it is left unchecked.
>> >>
>> >> how would i lay it out?
>> >>
>> >> Lynda.
>> >
>> >
>> >.
>> >
>
>
>.
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks