Checkbox and button snag

S

sungen99

I have been creating a spreadsheet and have been using a lot of th
suggestions here to create it however I have now hit a snag.

This is what I currently have done:

I have created a button that you press that is linked to a macro tha
will send emails along with attachments. It works great but sometime
you accidentally press the button it will do what its supposed to do.

What I did was create a linked checkbox.

What I would LIKE to be able to do is ONLY show the button if th
checkbox is checked.

Can I do that?

I would really like to be able to do it without VB as I really don
know how to program
 
K

K Dales

This is not hard, but unfortunately DOES require VBA
code. But hopefully I can give clear instructions.
First, I hope you used the Forms toolbar instead of the
Controls Toolbox to create the button and checkbox, just
because the instructions would be a bit different, and
they are easier if you use the Forms controls:

1) Right-click on your button. In the name box (that is
up on the left of the formula bar - the box that shows you
the name of the cell(s) or named range you have selected)
you will see the name Excel has given to your button -
probably "Button 1" or something like that. Write it
down - you will need it. Also make note of the worksheet
name and the cell address that your checkbox is linked to.

2) Right-click on your checkbox. Choose "Assign Macro..."

3) A list will appear with a selection shown up on top
as "Macro Name:" - probably something
like "Checkbox1_Click". Leave that as it is and
press "New..."

2) You will be in the VBA editor and you should see
something like this:

Sub Checkbox1_Click()

End Sub

3) In between the Sub Checkbox1_Click() line and the End
Sub line, type this (I am including the Sub and End Sub
lines) - except where I have Button1 make sure you are
using the name of your button, your worksheet, and the
linked cell for your checkbox. Here I will use "Button
1," "Sheet1," and "D4":

Sub CheckBox1_Click()

Sheets("Sheet1").Shapes("Button 1").Visible = Sheets
("Sheet1").Range("D4")

End Sub

4) Exit out of the VBA editor and back to Excel. Now
(hopefully!) when you check your checkbox the button will
appear.

Hope this works for you
K Dales
 

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