![]() |
Autorun a code when any cell is changed in a range
Hi,
I'd like to have my code run whenever a cell is changed in a named range. How do I do that? Gabor |
Autorun a code when any cell is changed in a range
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ws_exit: Application.EnableEvents = False If Not Intersect(Target, Me.Range("A1:H10")) Is Nothing Then With Target yourMacro End With End If ws_exit: Application.EnableEvents = True End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- HTH RP "Gabor" wrote in message ... Hi, I'd like to have my code run whenever a cell is changed in a named range. How do I do that? Gabor |
Autorun a code when any cell is changed in a range
Bob,
It works like dream. Thanks Gabor "Bob Phillips" schrieb im Newsbeitrag ... Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo ws_exit: Application.EnableEvents = False If Not Intersect(Target, Me.Range("A1:H10")) Is Nothing Then With Target yourMacro End With End If ws_exit: Application.EnableEvents = True End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- HTH RP "Gabor" wrote in message ... Hi, I'd like to have my code run whenever a cell is changed in a named range. How do I do that? Gabor |
All times are GMT +1. The time now is 03:49 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com