MrExcel Publishing
Your One Stop for Excel Tips & Solutions

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

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

Posted by Bob on October 29, 2001 10:52 AM

Juan, Thank You Very Much! "No Msg"