ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Scrollbars in Listbox (https://www.excelbanter.com/excel-discussion-misc-queries/153937-scrollbars-listbox.html)

sri

Scrollbars in Listbox
 
Hello All,

Is there any way to disable horizontal scroll bar in Listbox in VBA form.

I am just adding A-Z to that listbox with checkbox option, but horizontal
scroll bar is attached to it automatically.

When i adjust the width, it goes off, but i don't want to do this, as it
will spoil my design.

I checked the properties and the methods, there is no mention of scrollbar
anywhere.

Any help would be highly appreciated.

Thanks

--

Regards

Sri

Dave Peterson

Scrollbars in Listbox
 
If you play with the .width and .columnwidth, maybe you can get it to work the
way you want.

This worked for me:

Option Explicit
Private Sub UserForm_Initialize()
Dim iCtr As Long

With Me.ListBox1
.ListStyle = fmListStyleOption
.Width = 55
.ColumnWidths = 35
For iCtr = Asc("A") To Asc("Z")
.AddItem Chr(iCtr)
Next iCtr
End With
End Sub


Sri wrote:

Hello All,

Is there any way to disable horizontal scroll bar in Listbox in VBA form.

I am just adding A-Z to that listbox with checkbox option, but horizontal
scroll bar is attached to it automatically.

When i adjust the width, it goes off, but i don't want to do this, as it
will spoil my design.

I checked the properties and the methods, there is no mention of scrollbar
anywhere.

Any help would be highly appreciated.

Thanks

--

Regards

Sri


--

Dave Peterson

sri

Scrollbars in Listbox
 
Thanks Dave. I can aleast play with the Columnwidth to adjust the size.
--

Regards

Sri


"Dave Peterson" wrote:

If you play with the .width and .columnwidth, maybe you can get it to work the
way you want.

This worked for me:

Option Explicit
Private Sub UserForm_Initialize()
Dim iCtr As Long

With Me.ListBox1
.ListStyle = fmListStyleOption
.Width = 55
.ColumnWidths = 35
For iCtr = Asc("A") To Asc("Z")
.AddItem Chr(iCtr)
Next iCtr
End With
End Sub


Sri wrote:

Hello All,

Is there any way to disable horizontal scroll bar in Listbox in VBA form.

I am just adding A-Z to that listbox with checkbox option, but horizontal
scroll bar is attached to it automatically.

When i adjust the width, it goes off, but i don't want to do this, as it
will spoil my design.

I checked the properties and the methods, there is no mention of scrollbar
anywhere.

Any help would be highly appreciated.

Thanks

--

Regards

Sri


--

Dave Peterson



All times are GMT +1. The time now is 02:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com