Triggering a Macro for Drop-Down List Changes

by Allen Wyatt
(last updated January 16, 2014)

If you have Excel 97 and you create a macro that runs whenever a change occurs in your worksheet, you may have noticed an interesting phenomenon--the macro doesn't always run when you think it should. It runs just fine if you enter a new formula in a cell or enter a new value, but it doesn't run if you use data validation and someone picks something from the validation drop-down list.

Microsoft knows about this problem. In fact, you can find more information about it in the Knowledge Base, here:

http://support.microsoft.com/kb/172832

There are essentially several ways you can work around the problem. First, you could upgrade to a newer version of Excel. I'm not exactly sure which version it was corrected in, but I do know that in Excel 2003 selecting something from a data validation drop-down does trigger the Worksheet_Change event.

The second option is to use some other method of changing the worksheet data than with data validation. For instance, you could use a combo box from the Controls toolbox. Setting one up is a bit more difficult than using data validation, but much more versatile.

Finally, you could create a formula reference to the validated cell, and then trigger your macro from the Worksheet_Calculate event. For instance, if your validated cell is A7, then you could use the formula =A7 in a different cell. When the value in A7 changes (the user selects from the drop-down list), then a recalculation is begun because the results of the formula change. This, of course, triggers the Worksheet_Calculate event, where you could implement your macro. (Since the Worksheet_Calculate event can be triggered by lots of changes, you would need to add some checking code to your handler to make sure that the validation change is what ultimately triggered the event.)

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2398) applies to Microsoft Excel 97.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

A Shortcut for Switching Focus

Word provides keyboard shortcuts for lots of things, but it doesn't provide one for switching to the desktop and back to your ...

Discover More

Embedding Linked Documents

Word allows you to link one document to another document rather easily. If you later want to grab the contents of a linked ...

Discover More

Spelling Out Page Numbers

If your document is more than a couple of pages long, adding page numbers is a nice finishing touch. If you want, you can ...

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

More ExcelTips (menu)

Macro Fails after AutoFilter

When developing a macro that others may use, you might want to test it out to make sure it works properly if an AutoFilter is ...

Discover More

Trouble Recording Paste Special Formula

Sometimes, when you upgrade to a new version of Excel, you could run into a problem recording macros that you had no problem ...

Discover More

Error Using ATAN2 Function in Macro

Excel allows you to use worksheet functions from within macros. This is helpful, especially when you are trying to perform ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is four less than 8?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.