Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run a macro when validation field is activated
Hello.
Is it possible to make a macro runs when a cell with a validation data is activated, without using the ToolsMacroMacroRun option? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run a macro when validation field is activated
Yes. Use the Worksheet_SelectionChange event macro. That macro fires
whenever any cell selection is made. The code you write in that macro will limit action to the selection of just that one cell. Assuming the Data Validation cell is A1, and the macro you want to run is named MyMacro, the macro would look like this: Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Count 1 Then Exit Sub If Target.Address(0, 0) = "A1" Then Call MyMacro End If End Sub Note that this macro must be placed in the sheet module of that sheet that has the A1 Data Validation cell. To access that module, right-click on the sheet tab. select View Code, and paste this macro into that module. "X" out of the module to return to your sheet. HTH Otto "Icaro" wrote in message oups.com... Hello. Is it possible to make a macro runs when a cell with a validation data is activated, without using the ToolsMacroMacroRun option? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
MACRO ACTIVATED AYTOMATICALLY | Excel Discussion (Misc queries) | |||
E-mail macro - Field Validation | Excel Discussion (Misc queries) | |||
MACRO ACTIVATED EVERY 5 SECONDS | Excel Discussion (Misc queries) | |||
Run a macro when a Worksheet is clicked/activated | Excel Programming | |||
User Form activated by a macro | Excel Programming |