Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
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
Running VB macros gwtechie72 New Users to Excel 2 November 12th 07 10:04 PM
Running Macros Excel Worksheet Functions 0 July 6th 06 03:42 PM
Running macros automatically-AutoFit Cindy B Excel Worksheet Functions 1 January 16th 06 06:26 AM
HELP: Running two Macros, one before the other Bobbak Excel Programming 4 December 9th 03 01:27 PM
Running macros Mike[_34_] Excel Programming 1 July 17th 03 07:35 PM


All times are GMT +1. The time now is 02:42 AM.

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"