Formula for using check boxes

G

Guest

If this has been asked before, sorry for a repeat. In a form I' creating
that will be later imported to Access, some sections I have uses check boxes.
I'm very new to excel, especially using formulas.

For check boxes, like a Yes and No, if a person checks Yes, I would like the
cell to prevent the No box from being check and vice-versa. Also for check
boxes with multiple choices, if they check 3 items, I would like all 3 text's
to appear in the data field that will later be exported to Access. Is there
a way to do this? Thank you
 
G

Guest

Hell-fire:

It sounds like what you want in your Yes/No example is a optionbutton. It's
a little annoying to be prevented changing your mind in the middle of using a
form, so using a checkbox and preventing a change is possible, but probably
not the best. You can have several optionbuttons on the form. In the
properties of the optionbutton, you can set a groupname.

So, for example: with two questions you can have four optionbuttons

Optionbutton1 with caption "Yes" and groupname "Question1"
Optionbutton2 with caption "No" and groupname "Question1"
Optionbutton3 with caption "Yes" and groupname "Question2"
Optionbutton4 with caption "No" and groupname "Question2"
.... If you click Yes for question1, you can also click yes for question2.
If you change your mind on question1, you can click No... then optionbutton2
value becomes "true" and optionbutton1's value automatically becomes "false"

Also, use the properties to set the default value if you so choose.

On your second question:
Checkbox1 = "Include this"
Checkbox2 = "text"
Checkbox3 = "pig"
Checkbox4 = "in my"
Checkbox5 = "car"
Checkbox6 = "worksheet"

When you want to add the results of the checkboxes to a cell on the worksheet:

Dim myoutput as string
If checkbox1 = true then myoutput = myoutput & checkbox1.caption & " "
If checkbox2 = true then myoutput = myoutput & checkbox2.caption & " "
If checkbox3 = true then myoutput = myoutput & checkbox3.caption & " "
If checkbox4 = true then myoutput = myoutput & checkbox4.caption & " "
If checkbox5 = true then myoutput = myoutput & checkbox5.caption & " "
If checkbox6 = true then myoutput = myoutput & checkbox6.caption & " "
myoutput = left(myoutput, len(myoutput)-1)
myoutput = myoutput & "."
Msgbox myoutput

If you check boxes 1, 3, 4, and 5 you should get a message: "Include this
pig in my car." If you check boxes 1, 2, 4, and 6 you should get a message:
"Include this text in my worksheet." If you checkboxes 2,3,6 you should get
a message "text pig worksheet." which is admittedly nonsensical, but, you
should get the idea.

Hope this helps. Unfortunately, I can't comment on how the form or data
will perform under Access's environment, nor can I comment on how to import
data or anything else with Access, although the environments are similar.

drhalter
 

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