+ Reply to Thread
Results 1 to 7 of 7

Scroll using the Mouse Wheel in a ListBox

  1. #1
    Registered User
    Join Date
    11-20-2020
    Location
    Québec, Canada
    MS-Off Ver
    MS Office 2013
    Posts
    11

    Scroll using the Mouse Wheel in a ListBox

    Hi!

    I'm a total newbie when it comes to API. I have a pretty long ListBox in my UserForm and I would like to be able to use the mouse wheel to scroll through it. Trouble is I'm using a 64bit version of Excel and I can't find what I need to change from the 32bit code I found. Here's the code:

    In a module:
    Please Login or Register  to view this content.
    In the UserForm:
    Please Login or Register  to view this content.
    Now, when I run this as is, I get a compilation error. I need to change these:

    Please Login or Register  to view this content.
    to Declare PtrSafe. I did and now when I run it, I get a type incompatibility error with at least this sub

    Please Login or Register  to view this content.
    What else do I have to change to make it work with a 64bit version of Excel? Best case scenario would be a code that runs on either version, but I will be very happy if it works on 64bit.

    Hope I'm clear enough. If you need more info, I'll be glad to clarify!

  2. #2
    Forum Expert
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    2,277

    Re: Scroll using the Mouse Wheel in a ListBox

    Why not use the MouseUp_Event ?
    Far faster than Scrolling then selecting.
    All done with one action - hold down left button - drag down list - selection made on release.
    Saves 'acres' of code.
    torachan.

  3. #3
    Registered User
    Join Date
    11-20-2020
    Location
    Québec, Canada
    MS-Off Ver
    MS Office 2013
    Posts
    11

    Re: Scroll using the Mouse Wheel in a ListBox

    I want the process to go by instinct for the user. For that I need to recreate the process the user is used to. I don't mind a bit of coding. It might not be ideal but since I know it can be done with a 32bit version, there must be a way to do it with a 64bit version, right?

  4. #4
    Registered User
    Join Date
    11-20-2020
    Location
    Québec, Canada
    MS-Off Ver
    MS Office 2013
    Posts
    11

    Re: Scroll using the Mouse Wheel in a ListBox

    Hi again! Has anyone found a way to make this work?

  5. #5
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    2016 primarily
    Posts
    5,918

    Re: Scroll using the Mouse Wheel in a ListBox

    Have you searched this forum? I know this question has come up a few times before. (Hint: check the similar threads list at the bottom of the page)
    Rory
    I drink, and I know things

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    9,010

    Re: Scroll using the Mouse Wheel in a ListBox

    Play around with this...Should work with both 32 & 64 Bit

    Or why not just incorporate a "Type as You Go Filter" to narrow listbox selections....
    Attached Files Attached Files
    Last edited by sintek; 12-09-2020 at 08:25 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere.....
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember......Mark Thread as Solved.
    Excel Forum Rocks!!!

  7. #7
    Registered User
    Join Date
    11-20-2020
    Location
    Québec, Canada
    MS-Off Ver
    MS Office 2013
    Posts
    11

    Re: Scroll using the Mouse Wheel in a ListBox

    Quote Originally Posted by rorya View Post
    Have you searched this forum? I know this question has come up a few times before. (Hint: check the similar threads list at the bottom of the page)
    I did search for this but I always ended up with 32bit solutions... And I apparently couldn't find the other threads that I now find in the similar threads . Anyway, I see them now, guess I'll check them out, along with this ↓

    Quote Originally Posted by sintek View Post
    Play around with this...Should work with both 32 & 64 Bit

    Or why not just incorporate a "Type as You Go Filter" to narrow listbox selections....
    Sintek, thanks for the reply, I did incorporate the filter, it works flawlessy but I figured, if for some reason the user's list is shorter and they know their list pretty well they might want to scroll through it to find what they need. As I said to torachan, I want the process to go by instinct, and for that I need to think of anything a user might try to do. Right now the scroll and the filter are pretty much the only features I can think of that the user would use.

    Anyway, I will start playing around the bit of code you sent me. I think that might do what I need if I can tweak it a little. All in all, it's the closest to what I want to do, the only thing I need to figure out is how to avoid any selection when scrolling (I only need the view to change not change selection with the scroll). Any clue how to do it (if this can be done at all)?

    I'll keep digging on my side and update the thread if I find anything relevant

    Cheers!!

    Edit #1: Alright, I found what I need right here in /excel-programming-vba-macros/1249343-mouse-scroll-wheel-in-64-bit.html but I'm completely lost. I'll contact the programmer to see if he can explain a little bit
    Last edited by nightseeker; 12-10-2020 at 06:07 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Mouse Scroll Wheel in 64 bit
    By Soulfien in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-02-2020, 10:30 PM
  2. [SOLVED] Mouse Scroll Wheel in 64 bit help needed
    By Soulfien in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-13-2019, 09:19 PM
  3. Userform Listbox Move up/down using the Mouse Wheel Scroll
    By alexgoaga in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-07-2018, 08:08 AM
  4. Controlling Scroll in Listbox with Mouse wheel
    By bagullo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-09-2014, 09:05 AM
  5. Scroll with mouse wheel on userform
    By Josh_123456 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-08-2007, 08:19 PM
  6. scroll with wheel mouse
    By Scott in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-11-2005, 04:05 PM
  7. [SOLVED] scroll listbox with mouse wheel
    By RB Smissaert in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-26-2005, 05:55 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1