Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Automatically running macros
Hi,
How can I make a macro automatically run when any cell in a particular column is selected? Thanks for any help, Jon |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Automatically running macros
Right click on the sheet tab and select view code
put in code like this Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) if Target.count 1 then exit sub if Target.column = 3 then nameofyourmacro End if End Sub 3 is column C. Change to identify your column. If your macro will change the selection, you might want to disable events Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) if Target.count 1 then exit sub On Error goto ErrHandler if Target.column = 3 then Application.EnableEvents = False nameofyourmacro End if ErrHandler: Application.EnableEvents = True End Sub -- Regards, Tom Ogilvy "Jonathan Vickers" wrote in message ... Hi, How can I make a macro automatically run when any cell in a particular column is selected? Thanks for any help, Jon |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Running VB macros | New Users to Excel | |||
Running Macros | Excel Worksheet Functions | |||
Running macros automatically-AutoFit | Excel Worksheet Functions | |||
HELP: Running two Macros, one before the other | Excel Programming | |||
Running macros | Excel Programming |