Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I would like to execute my macro when I will modify data in selected cell. I
would like to use selection change even as the trigger. How I can do it ? Thanks for help. Tony |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
right click on the sheet tab and select view code. In the left dropdown
select worksheet. In the right dropdown, select selectionchange Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) End Sub put your commands there. Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) On Error goto ErrHandler If target.Address = "$A$9" then Application.EnableEvents = False End If ErrHandler: Application.EnableEvents = True End Sub -- Regards, Tom Ogilvy "Tony" wrote in message ... I would like to execute my macro when I will modify data in selected cell. I would like to use selection change even as the trigger. How I can do it ? Thanks for help. Tony |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Tom,
Thank you for help. But it is not exactly what I need. I would like the macro to execute when I am leaving this cell, not when I am entering. Could you please help me a bit more. Thank you. Regards, Tony "Tom Ogilvy" wrote: right click on the sheet tab and select view code. In the left dropdown select worksheet. In the right dropdown, select selectionchange Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) End Sub put your commands there. Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) On Error goto ErrHandler If target.Address = "$A$9" then Application.EnableEvents = False End If ErrHandler: Application.EnableEvents = True End Sub -- Regards, Tom Ogilvy "Tony" wrote in message ... I would like to execute my macro when I will modify data in selected cell. I would like to use selection change even as the trigger. How I can do it ? Thanks for help. Tony |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
A start would be to not say selectionchange when you mean Change <g:
Private Sub Worksheet_Change(ByVal Target As Excel.Range) On Error goto ErrHandler If target.Address = "$A$9" then Application.EnableEvents = False End If ErrHandler: Application.EnableEvents = True End Sub -- Regards, Tom Ogilvy "Tony" wrote in message ... Hi Tom, Thank you for help. But it is not exactly what I need. I would like the macro to execute when I am leaving this cell, not when I am entering. Could you please help me a bit more. Thank you. Regards, Tony "Tom Ogilvy" wrote: right click on the sheet tab and select view code. In the left dropdown select worksheet. In the right dropdown, select selectionchange Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) End Sub put your commands there. Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) On Error goto ErrHandler If target.Address = "$A$9" then Application.EnableEvents = False End If ErrHandler: Application.EnableEvents = True End Sub -- Regards, Tom Ogilvy "Tony" wrote in message ... I would like to execute my macro when I will modify data in selected cell. I would like to use selection change even as the trigger. How I can do it ? Thanks for help. Tony |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you for help. I have it working now.
Regards, Tony "Tom Ogilvy" wrote: A start would be to not say selectionchange when you mean Change <g: Private Sub Worksheet_Change(ByVal Target As Excel.Range) On Error goto ErrHandler If target.Address = "$A$9" then Application.EnableEvents = False End If ErrHandler: Application.EnableEvents = True End Sub -- Regards, Tom Ogilvy "Tony" wrote in message ... Hi Tom, Thank you for help. But it is not exactly what I need. I would like the macro to execute when I am leaving this cell, not when I am entering. Could you please help me a bit more. Thank you. Regards, Tony "Tom Ogilvy" wrote: right click on the sheet tab and select view code. In the left dropdown select worksheet. In the right dropdown, select selectionchange Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) End Sub put your commands there. Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) On Error goto ErrHandler If target.Address = "$A$9" then Application.EnableEvents = False End If ErrHandler: Application.EnableEvents = True End Sub -- Regards, Tom Ogilvy "Tony" wrote in message ... I would like to execute my macro when I will modify data in selected cell. I would like to use selection change even as the trigger. How I can do it ? Thanks for help. Tony |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to keep ONKey's macro on Worksheet Selection Change Event | Excel Programming | |||
Saving copied info while running a Selection Change Macro | Excel Programming | |||
Macro to change list box input range based on selection made in another cell | Excel Programming | |||
Selection change: How to run a Macro | Excel Programming | |||
Macro to only change selection | Excel Programming |