Is this possible with a Listbox control?

Peter h

Active Member
Joined
Dec 8, 2015
Messages
417
I was just curious if it's at all possible to make column 1 (or actually 0) in a multicolumn listbox always visible as you scroll right. Similar to how freeze pane works on a spreadsheet. If not, that's ok. I'm just curious.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
I agree with ranman256, but you might be able to do something with commandbuttons, which set the columnwidth.
 
Upvote 0
What you could perhaps do is place another list box on the left of the original, just showing column 1.
Then using the code below will it should align the data as its selected.

Code:
Private Sub ListBox1_Click()
    With ListBox2
        .TopIndex = ListBox1.TopIndex
        .ListIndex = ListBox1.ListIndex
    End With
End Sub

Private Sub ListBox2_Click()
    With ListBox1
        .TopIndex = ListBox2.TopIndex
        .ListIndex = ListBox2.ListIndex
    End With
End Sub
 
Upvote 0
A workaround would be to use 2 listboxes, one with all required columns (A) , the other with column 0 only (B)
B is placed on top of A - so column 0 is always visible when scrolling occurs in A
Group them together

You only mentioned scrolling right. It gets more complicated if you also want to scroll up and down - the values in A & B must then move in sync.

Read MickG post - same idea as mine :)
 
Last edited:
Upvote 0
Thanks for the ideas guys. Its not so important that I want to go through a bunch of trouble for it, but I might play around with it to see what I can come up with.
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,849
Members
449,051
Latest member
excelquestion515

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