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

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
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,223,898
Messages
6,175,274
Members
452,628
Latest member
dd2

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