Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
MACRO ACTIVATED AYTOMATICALLY Spiros Excel Discussion (Misc queries) 0 June 12th 08 07:25 AM
E-mail macro - Field Validation tqdinh22 Excel Discussion (Misc queries) 3 August 21st 06 10:11 PM
MACRO ACTIVATED EVERY 5 SECONDS CC Excel Discussion (Misc queries) 1 May 4th 06 03:02 PM
Run a macro when a Worksheet is clicked/activated Warren McGoldrick Excel Programming 3 July 25th 05 10:12 PM
User Form activated by a macro mxleite Excel Programming 3 July 3rd 04 01:33 AM


All times are GMT +1. The time now is 10:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"