Hide/Show Listbox in Worksheet

Sthrncali

Board Regular
Joined
Apr 1, 2011
Messages
226
I am seeing some strange behavior with a multi-select list box (ActiveX) that I have embedded in a worksheet.

I have a button that toggles the visible property of my list box to show/hide it from the user. The behavior I am seeing is that when I hide then show the list box, it won't let me select anything in it unless I toggle on design mode, then back off. Then I can make selections in the list box as normal. Then if I hit the button that hides it, it doesn't hide it remains on the screen allowing me to select/change it. Then again if I toggle design mode and back off, now the box goes away..

Is there a known issue or workaround to prevent this type of behavior?
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Excel 2007.

Code is

'Show Box
Code:
Sub Picture1_Click()
Sheet1.Shapes("ChartClose").Visible = msoTrue
Sheet1.Shapes("Chartbg").Visible = msoTrue
Sheet1.Shapes("SiteList").Visible = msoTrue
FillBox
Sheet1.Shapes("Chart1").Visible = msoTrue
End Sub

'Hide Box
Code:
Sub ChartClose_Click()
Sheet1.Shapes("ChartClose").Visible = msoFalse
Sheet1.Shapes("Chartbg").Visible = msoFalse
Sheet1.Shapes("SiteList").Visible = msoFalse
FillBox
Sheet1.Shapes("Chart1").Visible = msoFalse
End Sub
 
Upvote 0
I used code like this:

Code:
Private Sub CommandButton1_Click()
    Me.ListBox1.Visible = Not Me.ListBox1.Visible
End Sub

My ListBox was from the Control Toolbox (as was the CommandButton).
 
Upvote 0

Forum statistics

Threads
1,224,548
Messages
6,179,448
Members
452,915
Latest member
hannnahheileen

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