Thread: Macro to Cell
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Lloyd Don Lloyd is offline
external usenet poster
 
Posts: 119
Default Macro to Cell

Hi,
You could use the Worksheet_SelectionChange event.

For example, assuming the cell to be D10

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address="$D$10" then
MsgBox Target.Address
End If
End Sub

or using row and column numbers
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Row = 10 And Target.Column = 4 Then
MsgBox Target.Address
End If
End Sub

In place of the MsgBox, you could enter code or call a macro.

Hope that gets you started.
Don

"Ronbo" wrote in message
...
How do I assign a macro to a cell so that when one clicks on it a Listbox
opens or a macro runs?

Thanks