• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

run macro when cell value change

this is quite easy to run macro when cell value change
i found quite easile the code that i wrote it in sheet module
{Private Sub Worksheet_Change(ByVal Target As Range)
Dim KeyCells As Range
Set KeyCells = Range("I1:J1")
If Not Application.Intersect(KeyCells, Range(Target.Address)) _
Is Nothing Then
Call Macro4
End If
End Sub}

but in the same sheet i want this to be performed for 2 other cases
range g1 to run macro 5
and range g2 to run macro 6
i copy paste the code and made the changes but didn't worked
what is the wrong?
 
this is quite easy to run macro when cell value change
i found quite easile the code that i wrote it in sheet module
{Private Sub Worksheet_Change(ByVal Target As Range)
Dim KeyCells As Range
Set KeyCells = Range("I1:J1")
If Not Application.Intersect(KeyCells, Range(Target.Address)) _
Is Nothing Then
Call Macro4
End If
End Sub}

but in the same sheet i want this to be performed for 2 other cases
range g1 to run macro 5
and range g2 to run macro 6
i copy paste the code and made the changes but didn't worked
what is the wrong?


Try the Code Below

Code:
Option Explicit

Private Sub Worksheet_Change(ByVal target As Range)
  
  If Not Intersect(target, Me.Range("A1")) Is Nothing Then
  Call Macro1
  End If
  
  If Not Intersect(target, Me.Range("B1")) Is Nothing Then
  Call Macro2
  End If
  
  If Not Intersect(target, Me.Range("C1")) Is Nothing Then
  Call Macro3
  End If
  
  If Not Intersect(target, Me.Range("D1")) Is Nothing Then
  Call Macro4
  End If
  
  End Sub
 
Back
Top