ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Can I launch macro by a cell click ? (https://www.excelbanter.com/excel-discussion-misc-queries/17221-can-i-launch-macro-cell-click.html)

Cedric Dennis

Can I launch macro by a cell click ?
 
Hi
Can I launch a macro simply by clicking a cell ?
What command would I need to type in the cell ?
Please help if you can.
Thankyou
Cedric

Ron de Bruin

You can use this event in the sheet module for Cell A1
It will also run if you select the cell with the arrow keys

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Application.Intersect(Range("A1"), Target) Is Nothing Then
yourmacro
End If
End Sub

Sub yourmacro()
MsgBox "Hi"
End Sub




--
Regards Ron de Bruin
http://www.rondebruin.nl



"Cedric Dennis" wrote in message om...
Hi
Can I launch a macro simply by clicking a cell ?
What command would I need to type in the cell ?
Please help if you can.
Thankyou
Cedric




Don Guillett

right click sheet tabview codeinsert thissave to suitSAVE

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$C$1" Then doit
End Sub
Sub doit()
MsgBox "Hi"
End Sub

--
Don Guillett
SalesAid Software

"Cedric Dennis" wrote in message
om...
Hi
Can I launch a macro simply by clicking a cell ?
What command would I need to type in the cell ?
Please help if you can.
Thankyou
Cedric





All times are GMT +1. The time now is 01:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com