ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   how to activate macro from cell (https://www.excelbanter.com/excel-discussion-misc-queries/215544-how-activate-macro-cell.html)

artzuka

how to activate macro from cell
 
Can I activate macros from cell by clicking it??

Mike H

how to activate macro from cell
 
Hi,

You could do this. Right click your sheet tab, view code and paste this in
and then try selecting A1

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$1" Then
MyMacro
End If
End Sub

Sub MyMacro()
MsgBox "You Did it"
End Sub

Mike

"artzuka" wrote:

Can I activate macros from cell by clicking it??


artzuka

how to activate macro from cell
 
Thanks, It works well...

"Mike H" kirjoitti:

Hi,

You could do this. Right click your sheet tab, view code and paste this in
and then try selecting A1

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$1" Then
MyMacro
End If
End Sub

Sub MyMacro()
MsgBox "You Did it"
End Sub

Mike

"artzuka" wrote:

Can I activate macros from cell by clicking it??



All times are GMT +1. The time now is 03:48 AM.

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