Excel/Userforms

Advertisement


Question
Hi, Bob. Excel 2003. Some time ago, you explained how to get a drop down validation to be dependant on another dropdown validation using INDIRECT. However, I now want to know if this is possible in a userform. I want one dropdown to be department (no problem with this), but then I want a second one to just show a list of sections within the relevant department in the first dropdown. Hope you can give me a pointer or direct me to a link on the web. Regards  Graham

Answer
Suppose in A1:A2 you have
Fruit
Vegetable.
The Userform Initialization code would use:
Private Sub UserForm_Initialize()
   Me.ComboBox1.List = Application.Transpose(Range("A1:A2"))
End Sub

Now you also have ranges named Fruit and Vegetable, so when the user selects an item from the first combobox:
Private Sub ComboBox1_Change()
   Me.ComboBox2.List = Application.Transpose(Range(Me.ComboBox1.Value))
End Sub

HTH
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

Excel

All Answers


Answers by Expert:


Ask Experts

Volunteer


Bob Umlas

Expertise

I`m a Microsoft Excel MVP (Most Valuable Professional) and have been since the inception of the program in 1995. I can answer every kind of Excel question except: API, Importing/exporting to other programs (powerpoint, word,...)

Experience

Worked with MS Excel since version 0.99 (on the Mac!). Was contributing editor to Excellence Magazine, having written >300 articles. John Walkenbach said of me "I finally met someone who knows as much about Excel as I do."

Publications
Excellence, The Expert, Microsoft

Awards and Honors
MVP
Led sessions for the Convergence 2004-2006 seminar on Excel tips & tricks

©2012 About.com, a part of The New York Times Company. All rights reserved.