View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Leith Ross[_661_] Leith Ross[_661_] is offline
external usenet poster
 
Posts: 1
Default call macro if cell is selected


Hello Corey,

Yes you can. The drawback is the macro must be placed in the event code
of each Worksheet where you want to use it.

Here is the code. MyRange can be a single cell or range. Change MyMacro
to the name of the macro you wish to execute.


Code:
--------------------

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim MyRange As Range
Set MyRange = $A2:$E100
If Not Application.Intersect(Target, MyRange) Is Nothing Then Call MyMacro
End Sub

--------------------


Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=561911