Listbox vs. Dropdown

ryland00

Board Regular
Joined
Jun 13, 2014
Messages
76
Hello,

I am wondering if anyone can help. I am looking for a way to control which tabs are able to be unhidden based on a list. So basically, something very similar to a list box, but not a list box.. Let me explain

I have tried using a list box, but it just doesn't seem sustainable. While at first, it worked exactly for what I wanted. I found some VBA code that allowed exactly what I was looking for, the user could put a check mark next to the tab name and those tabs were un-hidden. The problem with the list box is it doesn't seem to work well with Excel. Every time I go away from the tab with the list box and come back to it, the font is smaller or the box is larger.

Hope you are able to help!


Thanks much,

Ryan
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Is this listbox a form control or an ActiveX control? Do you mind posting the code you are using for the lisbox?

Cheers
 
Upvote 0
Is this listbox a form control or an ActiveX control? Do you mind posting the code you are using for the lisbox?

Cheers

I believe ActiveX Control and yes, please see below. The box issues are just too much for me to want to continue to use.

Code:
Private Sub Worksheet_Activate()

ListBox1.MultiSelect = fmMultiSelectMulti
ListBox1.List = Array("GLOBAL", "APJC", "BAM", "EMEAR", "INDIA", "LATAM", "USC", "LATAMSC")


End Sub




Private Sub ListBox1_Change()


For i = 0 To ListBox1.ListCount - 1
    If ListBox1.Selected(i) = True Then
        Sheets(ListBox1.List(i)).Visible = True
        Else
        Sheets(ListBox1.List(i)).Visible = False
    End If
Next i


End Sub
 
Last edited:
Upvote 0
Setting the IntegralHeight to False stopped the resizing


I did actually have this option as False already, because I read the same thing. But that is when the font would shrink each time I left the tab, to the point where the user could no longer see the choices.
 
Upvote 0
sorry i thought the listbox itself was shrinking

if only the font is shrinking
maybe just add line in code to force it to the size what you everytime

Code:
Private Sub Worksheet_Activate()

ListBox1.MultiSelect = fmMultiSelectMulti
ListBox1.List = Array("GLOBAL", "APJC", "BAM", "EMEAR", "INDIA", "LATAM", "USC", "LATAMSC")
ListBox1.Font.Size = 12

End Sub
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top