Run Macro if certain cell change
Dear All,
Can we only run a macro if certain cell change? Eg. If contain for C4 change then run the macro. If yes, kindly guide me on setting up the function? Thank you. Best Regards, Kidd |
Run Macro if certain cell change
One way,
Enter the following in the worksheet code window (right-click the worksheet tab and choose View code (or similar)). '---- Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$C$4" Then MsgBox "You changed " & Target.Address End If End Sub '---- HTH Anders Silvén "Kidd" skrev i meddelandet ... Dear All, Can we only run a macro if certain cell change? Eg. If contain for C4 change then run the macro. If yes, kindly guide me on setting up the function? Thank you. Best Regards, Kidd |
Run Macro if certain cell change
another way is
Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, ActiveSheet.Range("c4")) Is Nothing Then Exit Sub 'run your code end sub -----Original Message----- One way, Enter the following in the worksheet code window (right- click the worksheet tab and choose View code (or similar)). '---- Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$C$4" Then MsgBox "You changed " & Target.Address End If End Sub '---- HTH Anders Silvén "Kidd" skrev i meddelandet ... Dear All, Can we only run a macro if certain cell change? Eg. If contain for C4 change then run the macro. If yes, kindly guide me on setting up the function? Thank you. Best Regards, Kidd . |
All times are GMT +1. The time now is 06:48 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com