Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

Excel - Check boxes in drop down box


  • Please log in to reply

#1
FutbolMolly

FutbolMolly

    Member

  • Member
  • PipPip
  • 33 posts
Hey guys,

I want to have a drop down box (like Data-Validation-List or Combo box, whichever works) with check boxes
inside of it.

Is this possible??

Thanks!!
Molly
TechMolly
  • 0

Advertisements


#2
Jonesey

Jonesey

    Member

  • Member
  • PipPipPip
  • 335 posts
AFAIK, the only way you can do this is by using a listbox in VBE.

The box must have a liststyle of 1 - fmListStyleOption and multiselect must be set to either multi or extended.
  • 0

#3
FutbolMolly

FutbolMolly

    Member

  • Topic Starter
  • Member
  • PipPip
  • 33 posts
Jonesey:

I brought up the control toolbox (View-Toolbars-Control Toolbox), inserted a list box, and made the changes you said in the properties. When I did that all I was left with was a blank box.

Thank you very much for your response,
Molly
TechMolly
  • 0

#4
dsenette

dsenette

    Je suis Napoléon!

  • Community Leader
  • 26,047 posts
  • MVP
checkboxes work differently than listboxes or comboboxes

to use the checkboxes you can just put the checkboxes into the form however you like...to my knowledge there's no way to get a checkbox inside of a listbox/combobox ....you can group them in a control box...that kind of links them together...

Edit: actually i think i see what jonesey was suggesting....instead of using checkboxes you would do as he suggested and make a listbox or combobox with the "multiple select" option on...then populate that listbox with the items you would have been using for the checkbox...then the user can select multiple items from the listbox the same way they would check multiple checkboxes
  • 0

#5
FutbolMolly

FutbolMolly

    Member

  • Topic Starter
  • Member
  • PipPip
  • 33 posts
> then populate that listbox with the items you would have been using for the checkbox

What do you mean when you say to populate the listbox? How would I do this? Sorry, I am very new to Excel.

Thanks!
Molly
TechMolly
  • 0

#6
Jonesey

Jonesey

    Member

  • Member
  • PipPipPip
  • 335 posts
If you're new to Excel then I'm afraid the route we're going down might be beyond you at your current level of expertise, as we're going into the programming side of Excel using Visual Basic.

The simple answer is that you can't do what you want using normal Excel commands.
  • 0

#7
FutbolMolly

FutbolMolly

    Member

  • Topic Starter
  • Member
  • PipPip
  • 33 posts
Jonesey,

I am a Computer Science major and have programming experience so I think it may be possible. If you don't mind just giving me simpler steps.

Thanks,
Molly
TechMolly
  • 0

#8
Jonesey

Jonesey

    Member

  • Member
  • PipPipPip
  • 335 posts

Jonesey,

I am a Computer Science major and have programming experience so I think it may be possible. If you don't mind just giving me simpler steps.

Thanks,
Molly
TechMolly


From Excel, go Tools > Macro > Visual Basic Editor
Insert a User Form
Insert a Listbox onto the form.

Look at the help files for use on how they're populated and accessed - the help files explain it a lot more eloquently than I could!!!!
  • 0

#9
dsenette

dsenette

    Je suis Napoléon!

  • Community Leader
  • 26,047 posts
  • MVP
populating a listbox is done by changing the "text" property of the control
  • 0

#10
Jonesey

Jonesey

    Member

  • Member
  • PipPipPip
  • 335 posts
Or you can use:

Userform1.Listbox1.AddItem itemname

For multiple instances of itemname, stick 'em in a loop

Use Multiselect = 2 - Extended.
  • 0

#11
Jonesey

Jonesey

    Member

  • Member
  • PipPipPip
  • 335 posts
To access and manipulate items in your list, once it's been populated, do something like this


For n = 0 to UserForm1.ListBox1.ListCount - 1

If UserForm1.ListBox1.Selected(n) = True then

do something

Else: do something different

End If


Next

_________________________________________


ListCount numbers items starting from 1
The Selected property numbers items starting from 0
Hence you need to modify the counter in the loop
  • 0

#12
FutbolMolly

FutbolMolly

    Member

  • Topic Starter
  • Member
  • PipPip
  • 33 posts
Thank you very much for all of your help. I really appreciated it!

Molly
TechMolly
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP