How do I disable the scroll bar in a listbox?

peter_z

Board Regular
Joined
Feb 27, 2011
Messages
87
Hey Guys,

I have a list box and I want to keep it the same size but for some reason one of the columns in the list box have a scroll bar which I want to get rid of even though the txt fits perfectly.

Does anyone have any code that disables the scroll bar?

Cheers for your help :)
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hey Guys,

I have a list box and I want to keep it the same size but for some reason one of the columns in the list box have a scroll bar which I want to get rid of even though the txt fits perfectly.

Does anyone have any code that disables the scroll bar?

Cheers for your help :)

Hi,
Maybe try

Code:
' API declaration
Option Explicit
Private Declare Function ShowScrollBar Lib "user32" (ByVal hwnd As Long, ByVal wBar As Long, ByVal bShow As Long) As Long

'Constants
Private Const SB_HORZ = 0 'Horizontal Scrollbar
Private Const SB_VERT = 1 'Vertical Scrollbbar
Private Const SB_BOTH = 3 'Both ScrollBars



Private Sub Form_Load()

' True = Show ScrollBar
' Hide = Hides ScrollBar

ShowScrollBar List1.hwnd, SB_VERT, False

End Sub
 
Upvote 0
Just make sure the column widths are set properly for each column.

One 'test' you could do try is to sum up the column widths and compare them to the width of the listbox.
 
Upvote 0
Hey guys thanks for your help so far, unfortunately none of these ideas work. I just need like an off switch for these scrollers as there is plenty of space for the data but for some reason this scroll bar just won't go away.
 
Upvote 0
Where is this listbox located?

I can't create a listbox that has scroll bars for indiividual columns.
 
Upvote 0
Hi Norie,

It is made in the Eexcel -> Developer tab -> Insert -> Form Controls -> List Box

Cheers Peter
 
Upvote 0
Peter

How exactly did you create this listbox?

I've tried various things and I can't even create a multicolumn listbox using a control from Form Controls.
 
Upvote 0
Is this listbox actually a combobox and it's the dropdown that has the scrollbar?
 
Upvote 0
Giving up on this now, just can't figure it out. In the end made the whole thing way bigger than it needs to be to get rid of the scroller.
 
Upvote 0

Forum statistics

Threads
1,224,517
Messages
6,179,233
Members
452,898
Latest member
Capolavoro009

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