Trigger Macro with Listbox VALUE Selection and NOT Arrow Key

avanura007

New Member
Joined
Aug 12, 2014
Messages
1
Hi, I have looked everywhere for this, but couldn't find my exact problem.

I have a listbox, with values 1 through 10. On selecting a value, I have a macro assigned to the listbox where am picking up the value from the target cell and hiding/unhiding an equal number of rows. It is a FORM CONTROL listbox.

I also have a reset button on pressing which, I am erasing the target cell of the listbox, thus setting it to null.

Problem is, in such a condition, if I directly press the arrow button, then the macro is being triggered, and the whole code is going into an infinite loop, and excel is hanging.

If I select a value from the listbox first (thereby populating the target cell), then scroll using the arrow keys, then select another value, then the code is working fine.

Is there any way to trigger the code by selection of a value only and NOT when the arrows in the listbox are pressed?

I am using EXCEL 2010.
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Forum statistics

Threads
1,216,175
Messages
6,129,312
Members
449,500
Latest member
Jacky Son

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