If I was doing it, I would set up a combo box on your sheet using the control toolbox toolbar. When you've set it up, with the design button pressed, double click the combo. It should take you to the VBA (Macro Editor).
1. I would always suggest modifying the name of your combo to follow Reddick Naming Conventions so in this case I modifed the name property to read "cboAnimals" (ie Combo Animals)
2. You will need to modify the code to be cboAnimals rather than Microsoft's choice of ComboBox1 - your call!
3. Now modify the ListFill property to be A1:A3 {ie your entries cat, dog, fish will be in these cells)
4. Now modify the Linked Cell property to read B1 {ie where your selection is output)
You can stop now and check that it works ok and allows you to select an animal from your list A1:A3. (Don't forget to click on the Design Button on the Control Box Toolbar to take it out of design mode)
Now reclick design button, double click your combo and put the following code into your Visual Basic Editor.
All this does is each time the combo is changed, it sets up a counter called i. Then each time through the loop it looks at A1 then A2 then A3 and so on to see if the cell is blank. If it is blank the loop ends (ie Do Until!) Lastly, it altered the ListFillRange Property you manually set earlier to be A1:A3 to be the A1:A?. Of course "?" is one less than our counter i so it will encompass everything up to but not including the first blank cell. Now every time you add an entry to your range A1:A?, it will automatically recompile the dropdown list for you.
I hope this helps and isn't too confusing. You'd probably find someone with years of experience would do this a different way, but I find this works for me.
ps Pat Molloys solution is a lot swisher and more sophisticated than mine with bells and whistles. If you can do and understand both methods it's well worth it.
pps I started out on VBA around Christmas. The best book I've found is Excel 2002 Visual Basic For Applications Step by Step
Excel 2002 Visual Basic For Applications Step by Step
Bookmarks