Archive of Mr Excel Message Board

Back to Excel VBA archive index
Back to archive home

On Cell Click Run Macro
Posted by Bob on October 29, 2001 8:09 AM
I found that you can draw a box around a cell and assign the macro to the box. However I want to Run a macro if it is in a named range. I need to have the exact cell highlighted for the macro later.
So if you click on Cell A1 and A1 belongs to the Group "Criteria" Then Run Macro.
Thanks, Hope I explained it clear.
Bob

| Check out our Excel VBA Resources
|
 |
 |
 |
 |
 |
Re: On Cell Click Run Macro
Posted by Juan Pablo on October 29, 2001 10:28 AM
Use
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Not Intersect(Target, Range("MyRange")) Is Nothing Then
MsgBox "Hello"
End If
End Sub
Change "MyRange" to your named range.
Juan Pablo

Juan, Thank You Very Much! "No Msg"
Posted by Bob on October 29, 2001 10:52 AM

This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our
online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.