listbox macro scrolling problem

F

Fan924

I have a listbox with a macro assigned. Macro activates when I click
on a different row in the listbox.
It also activates the macro when i scroll up and down. This is
undesirable. Can i turn this off while scrolling.
 
D

Dave Mac

I have a listbox with a macro assigned. Macro activates when I click
on a different row in the listbox.
It also activates the macro when i scroll up and down. This is
undesirable. Can i turn this off while scrolling.

Not sure re: which event your using, but try the _Itemclick event for
the control.

rgds,
David
 
R

Ryan H

There is an ItemClick Event? I don't see that.

Try the MouseUp or MouseDown Event. This event will fire when you mouse
button is clicked down or release.

Hope this helps! If so, let me know, click "YES" below.
 
J

JLGWhiz

I tried to duplicate the problem by using different events to trigger the
macro and could not get the same result. I could scroll without triggering
the macro when I used the click, change, key press, key down, mouse down
events. are you sure you are not clicking inside the display window?
 
D

Dave Peterson

If you're going to use a listbox from the Forms toolbar, I wouldn't assign a
macro to it.

Instead, I'd add a button from the Forms toolbar right near that listbox. Then
let the user do what they want with the listbox and when they're ready, they can
click on the button (that has the macro assigned to it).
 
F

Fan924

Nice dave as always. Thanks all.
I end up adding a filter to the front end of the macro. The macro only
runs now when the list index number is changed. This filters out the
triggering of the macro by the scrollbar.

If Range("AH10").Value = .ListIndex Then ' old value at Range
("AH10").Value
Exit Sub
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top