View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Shawn O'Donnell Shawn O'Donnell is offline
external usenet poster
 
Posts: 42
Default sometimes it takes one variable, sometimes another ...

"Larry Levinson" wrote:
No errors, but the variables are not being stored/passed/used UNLESS,
once the user form loads, you make a change IN the listboxes. THEN, it
takes the values in the listboxes.


Now I see it. I built a spreadsheet to duplicate what you're doing, using
the code you posted. I set the control source of each of the controls to a
cell on the spreadsheet, and those cells get assigned the right values when
the form loads. But not every time.

Sometimes when I run start(), only one or two of the listboxes appears with
a highlighted selection and a value in the controlsource cell. If I repeat
the macro a couple of times, I can usually get all the listboxes to operate.

When things don't work, there's a grey box around the value in a textbox
that should be selected, but it isn't selected (highlighted.) And in the
immediate window, when I ask for the .Value or .Text of the faulty listbox, I
get nothing, even though they should have been set. Something funky is going
on with the events here.

I can reset to the problematic mode by clearing the controlsource cells and
changing the rowsource of one of the boxes. That seems to generate the
fault. But by running the macro enough times, I can get it to behave
properly.

I'm curious about what's happening. Let me know if you find an explanation.

BTW, Excel 2003 here.