-
Weird Excel Question.
I asked this over in news:microsoft.public.excel.programming and haven't seen a nibble on it yet, but maybe there's an excel guru lurking here? The title of this post is:
Confused Code: Wrong Visible Property Selection
----------------------
Maybe I'm not reading or coding this right, but anyway:
Got two ComboBox's named SortByStar and RotateByWhat
In the properties of each box, I've selected whether I want the ComboBox Visible:
SortByStar.Visible = True
RotateByWhat.Visible = False
Upon exiting design mode, the opposite happens, SortByStar becomes False, and RotateByWhat becomes True. Ok, what's going on. Hmm, I know, I'll set code into my startup to set the states of each ComboBox, (which also contains code to load the values for the box's). So:
SortByStar.AddItem "SP"
SortByStar.AddItem "SMK"
SortByStar.Visible = True
RotateByWhat.AddItem "HD"
RotateByWhat.AddItem "SAO"
RotateByWhat.Visible = False
And I'll be dipped in paint if the Box's FLICKER! and the opposite happens, SortByStar remains FALSE and RotateByWhat remains TRUE!
I'm very confused.
https://discussions.virtualdr.com/
------------------
turbopoweredbylynx http://lynx.browser.org/
-
Seems like there must be other code changing these objects - where else are they referenced and in what context - post the modules if you need to.
(I mean there must be code somewhere to make the "RotateByWhat" item visible at some stage after something (an OnEvent)?
Is there also something intended to make te "SortByStar" hidden?
Are these the only two controls on the sheet or are there others?
Can you set the visible property of another control (insert another "dummy" control if you need to) to rule out a bug in Excel itself. If it hides OK, we can assume it's somewhere in your code.
------------------
Sean (Smurfy)
....................
Please remember that others may need to know the outcome of your problem so please keep us updated.
-
Whew, I may not answer all in order, but:
Lots of controls, 7 Buttons, 2 ListBoxs, 3 SpinButtons, and now, 3 ComboBoxs, just added the third for your suggested test. BTW, setting one Visible.False sets them ALL False, yet only the First one I added to the sheet goes False, SortByStar. MBTW, all this code is in the Sheet.
(Button)Load, Initializes the ComboBoxs, locates the various sheets available to work with and loads their names into the ListBoxs.
Nothing else works properly until I select an item off each list, then the first line from each sheet selected gets loaded into the 'Buffer', (Sheet Name). Everything checks to see if its sheet name is empty, If SheetName = "" Then Exit Sub.
(Buttons)MakeSingle, MakeDouble, combines the two top most items from each sheet and pastes, err, writes them to the next free line in SheetResults. MBTW: if Results does not exist, code creates it. Code then uses a module level macro to delete the lines from the source sheets. And updates my display.
Hmm, Ought to mention this, the three SpinButtons step through the datasets, two scroll up/down through each sheet, (Simbad and Extract), while the third 'rotates' the upper dataset in Buffer from Extract.
(Combo)SortByStar, OnChange calls upon Macro to sort by selected column.
(Button)Import, First Click, makes (Check)Move Visible and Checked, scans directory for available sheets for importing, loads them into (List)Extract. Second click, If no Item was selected, resets (Check)Move, and exits, otherwise will import the selected sheet.
Getting wordy, but as you see, this is a very busy project, the idea was I just wanted to save a little real estate and overlap a couple of controls, so I did what I said in the first post, and blinked! I always try to make little changes to my coding projects, check each step before going to the next, so this phenomena was present from the very first insertion of the new ComboBox! But nothing 'runs' unless I press a button. Or select an item from a ComboBox. Or ListBox.
------------------
turbopoweredbylynx http://lynx.browser.org/