ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is this possible? Click a cell to run a macro (https://www.excelbanter.com/excel-programming/378017-possible-click-cell-run-macro.html)

John Smith

Is this possible? Click a cell to run a macro
 
I would like the users to be able to run a macro but not from the
menu bar. Is it possible for users to click a cell to run a macro?
If not, what's the closest thing to it? Thanks.

Snake Plissken[_2_]

Is this possible? Click a cell to run a macro
 
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Address() = "$A$1" Then

Call "myMacro"

End If


End Sub



Snake Plissken[_2_]

Is this possible? Click a cell to run a macro
 


| Private Sub Worksheet_SelectionChange(ByVal Target As Range)
|
| If Target.Address() = "$A$1" Then
|
| Call "myMacro"
|
| End If
|
|
| End Sub
|
|
1. the code above should be put in sheet area in VBA editor

2. of course "myMacro" is the name of a macro so write it without quotation
marks




All times are GMT +1. The time now is 02:02 PM.

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