Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Use Contents of Drop Down List

I have a drop down list with about 15 items sourced from a column
(outside the printable area) on the same worksheet. I normally select
each value individually and then print the resulting sheet. I was
looking to automate this process via a macro. Can anybody tell me the
syntax needed for a macro that selects the desired value from the drop
down list. Thanks.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Use Contents of Drop Down List

hey hey

i fear you may have to give a little more info on what you want to do
as your post leaves a lot up to imagination, you can add code to the
combobox by right clicking and selecting view code.

something like this may give you an idea of what i mean

Private Sub ComboBox1_Change()

'set a single piece of code to work with the combobox value

MsgBox "You chose " & ComboBox1.Value

'do something different with each value

Select Case ComboBox1.Value

Case 1
MsgBox "add the code you want for this one here"
Case 2
MsgBox "or do something else here"
Case 3
MsgBox "maybe just do nothing"

End Select

End Sub

hope it helps

Steve

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Use Contents of Drop Down List

Steve,

I'm not looking to add items to the combo box, I'm looking to use the
existing items in the combo box in a macro. For example, if my combo
box has three items (sales, direct cost, overhead) and since each item
(sales, direct cost, overhead) produces a different result, given
other formulas are on the sheet that use the combo box value. I would
like the macro to change the combo box value (ie: sales, direct cost,
overhead), recalculate the sheet, and the print the resulting page for
each value (sales, direct cost, overhead). But in my case I have 15
items. Hope that clarifies what I'm looking to do. Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Use Contents of Drop Down List

Change the ListIndex property of the ComboBox.

ComboBox1.ListIndex = 5 'whatever

Note that the ListIndex is 0-based, so the first item is ListIndex = 0, the
second item is ListIndex = 1, and so on up through ListIndex = ListCount -
1.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)

wrote in message
s.com...
Steve,

I'm not looking to add items to the combo box, I'm looking to use the
existing items in the combo box in a macro. For example, if my combo
box has three items (sales, direct cost, overhead) and since each item
(sales, direct cost, overhead) produces a different result, given
other formulas are on the sheet that use the combo box value. I would
like the macro to change the combo box value (ie: sales, direct cost,
overhead), recalculate the sheet, and the print the resulting page for
each value (sales, direct cost, overhead). But in my case I have 15
items. Hope that clarifies what I'm looking to do. Thanks


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copying the contents of a drop down list from the listbox itself? Digi777 Excel Discussion (Misc queries) 0 January 25th 10 10:06 PM
How do I change contents of a cell based on drop down list selecte yateswdy Excel Worksheet Functions 2 October 21st 09 03:18 AM
Drop Down List choice selecting another drop down list CVD0722 Excel Worksheet Functions 3 October 31st 06 01:02 PM
Need a conditional drop-down list (list contents) S&F Tie Guy Excel Programming 0 March 31st 06 03:21 PM
multiple select from the drop down list in excel. list in one sheet and drop down in sriramus Excel Discussion (Misc queries) 5 October 27th 05 06:55 PM


All times are GMT +1. The time now is 05:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"