![]() |
Need to create "on change" logic.
I need to create a routine to fill the remaining cells in a row with pre-set
values based on the change in contents (value) of a given row in column "A". In the overall scheme of things, where does this routine reside and what are best practices to follow. Thanking you in advance. Helmut |
Need to create "on change" logic.
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A10" '<=== change to suit On Error GoTo ws_exit: Application.EnableEvents = False If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then With Target 'do your stuff 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 Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Helmut" wrote in message ... I need to create a routine to fill the remaining cells in a row with pre-set values based on the change in contents (value) of a given row in column "A". In the overall scheme of things, where does this routine reside and what are best practices to follow. Thanking you in advance. Helmut |
Need to create "on change" logic.
Bob, Thank you. Helmut
"Bob Phillips" wrote: Private Sub Worksheet_Change(ByVal Target As Range) Const WS_RANGE As String = "A10" '<=== change to suit On Error GoTo ws_exit: Application.EnableEvents = False If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then With Target 'do your stuff 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 Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Helmut" wrote in message ... I need to create a routine to fill the remaining cells in a row with pre-set values based on the change in contents (value) of a given row in column "A". In the overall scheme of things, where does this routine reside and what are best practices to follow. Thanking you in advance. Helmut |
All times are GMT +1. The time now is 03:24 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com