![]() |
Cell Selected to run Macro
If i select a Cell, how can i run a macro, rather than having a button?
Regards Corey |
Cell Selected to run Macro
Right click on your sheet tab and paste this into the code window
Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Address = "$A$1" Then MsgBox "Hello" End If End Sub modify to suit your needs. "Corey" wrote: If i select a Cell, how can i run a macro, rather than having a button? Regards Corey |
Cell Selected to run Macro
Through a SheetSelectionChange event:
1) Create a Workbook_SheetSelectionChange macro in the code section of ThisWorkbook 2) Specify the cells that should trigger a macro Example (macro is triggered when you select A3): Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range) If Target.Address(0, 0) = "A3" Then MsgBox "Hi, I'm cell " & Target.Address End If End Sub Cheers, Joerg "Corey" wrote in message ... If i select a Cell, how can i run a macro, rather than having a button? Regards Corey |
All times are GMT +1. The time now is 01:11 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com