Worksheet Auto-Scrolls when I select an item within a listbox object

Max1616

Well-known Member
Joined
Nov 25, 2015
Messages
539
Office Version
  1. 2016
Platform
  1. Windows
Odd issue I'm having, I'm hoping someone here can help.

I have an Excel workbook with a listbox and roughly 20 items populated. This listbox allows for multiple selection (Check box). The issue I'm having is that when I select an item, the worksheet auto-scrolls down for some reason (as if I used my mouse's scroll wheel on the worksheet).

Any ideas how to stop this from happening? It seems to only be occurring when the entire list box doesn't show on your screen (i.e. a portion of the listbox is below the bottom of the screen or top of the screen). See the screenshot for a before and after example.

Thanks in advance for your help!
 

Attachments

  • Pre Selection.png
    Pre Selection.png
    39.1 KB · Views: 18
  • Post Selection.png
    Post Selection.png
    45.9 KB · Views: 20

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Here's the code I came up with to fix this issue:
VBA Code:
Sub Macro1()

Dim ScrollLoc As Integer

ScrollLoc = ActiveWindow.ScrollRow

'Code that runs when the list box is clicked goes here

ActiveWindow.ScrollRow = ScrollLoc
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,214,631
Messages
6,120,645
Members
448,974
Latest member
DumbFinanceBro

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