Hide Group Boxes Around Option Buttons

S

salqa

I need to hide the group box (lines and all) around each set of option
(radio) buttons for an electronic form that goes to customers. It's just for
aesthetic purposes - mgt doesn't want to see the lines! Any/all help is
greatly appreciated.
 
M

Mike H

Hi,

There are several places you could put this code, here's one

Private Sub Worksheet_Activate()
ActiveSheet.GroupBoxes.Visible = False
End Sub

Mike
 
S

salqa

Thanks, Mike, but I don't understand - would you elaborate as to what you
mean by "several places"? Also, when you reference "code", is that the same
as "formula"? Your help is appreciated!
 
M

Mike H

Hi,

Once the boxes are invisible then they remain invisible so you could simply
put the line of code in the immediate window.

ALT+Fll and then Ctrl + G to open immediate window.
Paste the code in and hit enter and the boxes on the active sheet become
invisible. Make each sheet the active one by selecting it's tab and repeat
the above.

The example I gave you was to use event code.
Alt + F11 to open VB editor. Double click the sheet name where you have
boxes and paste the 3 lines in on the right. Doing it this way the next time
you activate the sheet the box will become invisible. There's a slight
penalty for doing it that way in that the code runs every time you activate a
sheet even though the boxes are already invisible but the penalty is trivial.

And the one last way is this. Alt + Fll to open VB editor. Double click
'This workbook' and paste this in on the right

Private Sub Workbook_Open()
For Each Sheet In ThisWorkbook.Worksheets
Sheet.GroupBoxes.Visible = False
Next
End Sub

When the workbook is opened all boxes on all sheets become invisible

HTH.

Mike
 
P

Paul Norman

I would like to hide the group boxes around option buttons. I have tried the methods outlined by Mike and none of them worked for my spreadsheet. There are approx. 160 group boxes on my spreadsheet.
As a test I copied a small portion of the grounp boxes to another spreadsheet and I'm please to say that Mike's suggestions did work.
I would appreciate very much if anyone can offer any suggestions as to what may be 'going wrong'?
Thanks.
 
D

Dave Peterson

activesheet.groupboxes.visible = false
will work for a small (whatever that means) number of groupboxes.

But if you have lots, you can use:

dim GBX as groupbox
for each GBX in activesheet.groupboxes
gbx.visible = false
next gbx
 
P

Patrick Wilkins

I tried inserting this code into the immediate field and kept getting the
Next without For error.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top