PDA

View Full Version : on workbook open, form optionbutton loses position when unhidden



Junoon
08-01-2012, 08:32 PM
Hi,

i am currently facing a very odd problem with optionbuttons and groupboxes.

i have generated a set of form optionbuttons on a worksheet on certain rows and placed inside groupboxes, where each groupbox encloses 4 optionbuttons.

When i click the Reset button, the rows 14:56 hide along with the groupboxes and optionbuttons placed in them.
when i click the UnReset button, the rows 14:56 unhide along with the groupboxes and optionbuttons placed in them.

Now, the problem:

when i Reset or Hide the rows, groupboxes and optionbuttons and then SAVE the workbook and close it, then when i reopen it again, and click the unReset button to unHide the rows, groupboxes and optionbuttons, i see that all the optionbuttons, groupboxes etc lose their positions and only line up on the starting row 14.

P.S: i have not hidden the rows in the attached workbook, so that you can try and see the issue on your own.

please advise.

Excel Fox
08-01-2012, 10:33 PM
Without opening your file, can I ask whether you changed the property of the shapes to 'Do Not Move or Size With Cells'

If not, try doing that, and check the workbook again.

Junoon
08-01-2012, 10:58 PM
Hi ExcelFox,

the optionbuttons were created using the default setting i.e. OptionButton.Placement = xlFloating & not OptionButton.Placement = xlMove. Even if i hardcode OptionButton.Placement = xlFloating, it still moves. Actually, i have tried both alternatives, but still the optionbuttons move from the original location.

See the problem is, if i delete and generate buttons and then hide/unhide buttons, it works well, no issues. But if i hide the buttons, save & close file, and then open it again, then try to unhide it, then the optionbuttons donot stay in their correct position.

please advise.

Excel Fox
08-02-2012, 01:49 PM
I don't see any shift in position after unhiding after saving and closing with the buttons hidden. The only advice I can give is that the syntax you should use is xlFreeFloating, not xlFloating

Junoon
08-02-2012, 02:02 PM
Hi ExcelFox,

Thank you for replying.

yes it was a typo error.

Well, i think before closing the file you must have unhidden it. try hiding the controls using the reset button. save, close and then open the file and then unhide the controls. i am sure you will see error. :)

Excel Fox
08-02-2012, 02:48 PM
I did just that! No difference at all!

Junoon
08-02-2012, 03:03 PM
i tried this in Excel 2007/2010. in both versions, i am getting same issue. waiting to test in 2003. will let you know soon.

Excel Fox
08-02-2012, 03:59 PM
I am on 2007...

Junoon
08-05-2012, 10:07 AM
hi,

apologies for the delay. tried posting y'day but the website was down for maintenance.

i have found that .placement =xlfreefloating works very well for hiding/unhiding all optionbuttons on worksheet on workbook open. thanks.

However, now hiding and unhiding individual rows of optionbuttons (region rows) based on tick/untick of region checkboxes donot work. the option buttons and groupboxes donot hide, but shift up or down. what could be the reason? please advise.

P.S i have attached the latest file.