Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Is there a way to assign a macro to a cell such that clicking (or double
clicking) the cell executes the macro? Thanks, RUM |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
You can pick up either a selction change
Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Row=1 and Target.Column=1 then 'do Stuff End If End Sub a double click Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, _ ByVal Target As Range, ByVal Cancel As Boolean) If Target.Row=1 and Target.Column=1 then 'do Stuff End If End Sub or a right click Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, _ ByVal Target As Range, ByVal Cancel As Boolean) If Target.Row=1 and Target.Column=1 then 'do Stuff End If End Sub The code would go in VBA on the sheet where your target cell resides and not a seperate module. Change the Target.Row=1 and Target.Column=1 to whatever cell you desire. -- If this helps, please remember to click yes. "Bob Myers" wrote: Is there a way to assign a macro to a cell such that clicking (or double clicking) the cell executes the macro? Thanks, RUM . |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
You would probably learn a heck of a lot if you read this:
http://www.cpearson.com/excel/Events.aspx -- Ryan--- If this information was helpful, please indicate this by clicking ''Yes''. "Paul C" wrote: You can pick up either a selction change Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Row=1 and Target.Column=1 then 'do Stuff End If End Sub a double click Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, _ ByVal Target As Range, ByVal Cancel As Boolean) If Target.Row=1 and Target.Column=1 then 'do Stuff End If End Sub or a right click Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, _ ByVal Target As Range, ByVal Cancel As Boolean) If Target.Row=1 and Target.Column=1 then 'do Stuff End If End Sub The code would go in VBA on the sheet where your target cell resides and not a seperate module. Change the Target.Row=1 and Target.Column=1 to whatever cell you desire. -- If this helps, please remember to click yes. "Bob Myers" wrote: Is there a way to assign a macro to a cell such that clicking (or double clicking) the cell executes the macro? Thanks, RUM . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Formula or Macro to Assign Cell Locations | Excel Discussion (Misc queries) | |||
Assign F1 as a macro? | Excel Discussion (Misc queries) | |||
Assign Macro to tab | Excel Discussion (Misc queries) | |||
Assign Macro | Excel Discussion (Misc queries) | |||
Un-assign a macro | New Users to Excel |