Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / June 2007

Tip: Looking for answers? Try searching our database.

Formula for using check boxes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Hell-fire - 12 Jun 2007 01:13 GMT
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
drhalter - 14 Jun 2007 21:34 GMT
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

> 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.
[quoted text clipped - 5 lines]
> to appear in the data field that will later be exported to Access.  Is there
> a way to do this?   Thank you
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.