check and uncheck macro

J

jd64361

How can I use the checkbox to use a different macro when it's checked
or unchecked? In this example: I want to copy paste from one location
if
is unchecked and from a different location if is check and I uncheck
the checkbox.

Facts:

The checkbox is placed on a worksheet, named May

A checkbox from the Forms toolbar


My checkbox is number 11 (checkbox11)

the first task is to copy c11 to c17 and paste special as a value if
I
check the box, the second option is if I uncheck the box go and copy
b29 to b35 and paste it in c11 to c17.
yes is a check box from the developer tab under form controls.



Thank you
Pamela
 
S

Shane Devenshire

Hi,

Form Checkboxes allow linking the checkbox to a cell. That cell will
contain True or False depending on whether the box is checked or not.
Suppose the linked cell is A1 then

If Sheets("Sheet1").[A1] = TRUE then
'your code here
Else
'more code here
End If
 
J

JE McGimpsey

There's really no advantage to the added indirection of linking to a
cell when you can check the checkbox status directly:

If Sheets("Sheet1").Checkboxes("Checkbox11").Value = xlOn Then
'your code here
Else
'more code here
End If


There are a couple of potential disadvantages - e.g., changing the value
in the linked cell changes the checkbox status, but doesn't fire the
assigned macro, among others...


Shane Devenshire said:
Hi,

Form Checkboxes allow linking the checkbox to a cell. That cell will
contain True or False depending on whether the box is checked or not.
Suppose the linked cell is A1 then

If Sheets("Sheet1").[A1] = TRUE then
'your code here
Else
'more code here
End If

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


How can I use the checkbox to use a different macro when it's checked
or unchecked? In this example: I want to copy paste from one location
if
is unchecked and from a different location if is check and I uncheck
the checkbox.

Facts:

The checkbox is placed on a worksheet, named May

A checkbox from the Forms toolbar


My checkbox is number 11 (checkbox11)

the first task is to copy c11 to c17 and paste special as a value if
I
check the box, the second option is if I uncheck the box go and copy
b29 to b35 and paste it in c11 to c17.
yes is a check box from the developer tab under form controls.



Thank you
Pamela
 
D

Dave Peterson

Check your other thread, too.

How can I use the checkbox to use a different macro when it's checked
or unchecked? In this example: I want to copy paste from one location
if
is unchecked and from a different location if is check and I uncheck
the checkbox.

Facts:

The checkbox is placed on a worksheet, named May

A checkbox from the Forms toolbar

My checkbox is number 11 (checkbox11)

the first task is to copy c11 to c17 and paste special as a value if
I
check the box, the second option is if I uncheck the box go and copy
b29 to b35 and paste it in c11 to c17.
yes is a check box from the developer tab under form controls.

Thank you
Pamela
 
P

Pantera

There's really no advantage to the added indirection of linking to a
cell when you can check the checkbox status directly:

   If Sheets("Sheet1").Checkboxes("Checkbox11").Value = xlOn Then
      'your code here
   Else
      'more code here
   End If

There are a couple of potential disadvantages - e.g., changing the value
in the linked cell changes the checkbox status, but doesn't fire the
assigned macro, among others...

Form Checkboxes allow linking the checkbox to a cell.  That cell will
contain True or False depending on whether the box is checked or not.  
Suppose the linked cell is A1 then
If Sheets("Sheet1").[A1] = TRUE then
   'your code here
Else
   'more code here
End If
Cheers,
Shane Devenshire
"(e-mail address removed)" wrote:

- Show quoted text -

the if sheets line is debuging any idea why?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top