PDA

View Full Version : Solved: Combo Box loses all entries after running code



GreenTree
01-15-2007, 05:13 PM
Hello!

I'm using VBA and several worksheets to do a lot of processing on a bunch of data from text files. One of the first things needed is that the user selects a city (using a 3-letter airline code) out of a list, also a month and a year, and a couple of yes/no's. I use combo boxes for all of these, in each case referring to a range on the same worksheet for the possible values. Then, based on what's selected, when the user clicks on a button, the processing commences. Everything works fine to this point.

What's goofy is this: after the initial processing, the user can click another button to go to a "display" worksheet, and move around the data. When I select the original "welcome" sheet again where I'd expect to be able to select a different city or month or change a yes/no, the combo boxes all have NOTHING in them when I click the drop down arrow... no cities to choose from, no months, nada. The previously selected values are still there, but nothing else. The range is still on the spreadsheet below, and when I look at the Properties for the combo box, the ListFillRange still points where it should. AND, when I save the spreadsheet, exit Excel, and reload, everything works fine (until I do the number grinding, and the problem shows up again like clockwork).

I'd post the spreadsheet, except that without the external data there's no processing to be done, and the external data is (a) huge, and (b) slightly private, and I don't have any idea how to de-identify the data without making it impossible to process.

Using Excel 97. Utter novice to VBA. No code associated with any of the combo boxes.

If this sounds like a known issue that anybody's seen before, I'd be very grateful for any fixes. If this is falling into the "sounds strange, no guess what's going on until I see it" category, I may be out of luck & need to go about this some other way.

Many thanks!

lucas
01-15-2007, 06:11 PM
Hi GreenTree,
If this is on a userform you should have an initialize statment to populate your comboboxes, etc.

GreenTree
01-15-2007, 07:33 PM
Hi Lucas,

Thanks for the quick reply. I don't think I'm using a userform, as the combo boxes are just on the spreadsheet itself, and up until I do the number grinding, they work as expected & show all the cities, all the months, etc just fine.

Interestingly, I exported the spreadsheet to my desktop machine, which has Excel 2003 on it, and the problem doesn't show up there (at least so far). So perhaps it's just a glitch in Excel 97. If there's an easy fix so that the spreadsheet behaves correctly under 97 as well as 2003, though, it would be good to know about.

Thanks,

GT

lucas
01-15-2007, 07:46 PM
Hi GT,
Yep, time to come out of the stone age...everybody has put 97 in the past(I thought). I don't have it so I can't even test for your problem...maybe one of the few that do have it will come along.

GreenTree
01-15-2007, 09:06 PM
As soon as Vista is available on new computers, I'll be getting a new laptop & all the latest MS Office apps, at which point I'll be (slightly more) caught up with the modern world.

As I said, the amount of data that this project uses makes it hard to share the spreadsheet, so I wasn't really thinking others would be able to test or reproduce the problem with MY code, just hoping that from my description, somebody would remember a similar experience that was solved with something simple (if not obvious). But no big deal if not; I can live with the nuisance until I leave the animal skins & flint tools behind in a few weeks!

GT

lucas
01-16-2007, 09:28 AM
Good news GT. Sounds like your taking a huge leap...

ps please mark your thread solved using the thread tools at the top of the page.