Activate a macro if a given cell chages value (Private Sub)

I have tried entering the below and it just does not work within the Sheet1 code (Worksheet Change) and I do not understand why. This is a new requirement for me and it is holding up a process that is suppose to be done by end of week.

Thanks for the help in advance
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim rg As Range, cel As Range
    Dim strFormat As String
    
    Set rg = Intersect(Target, Cells(6, 6))
    
    If rg Is Nothing Then Exit Sub
    If Cells(6, 6) <> "" Then
        Cells(6, 6).FormulaR1C1 = "=R[-2]C*12" 'simple test code
    End If
End Sub

Open in new window

LVL 2
bearblackGlobal Program ManagerAsked:
Who is Participating?
 
StephenJRConnect With a Mentor Commented:
Add this line at the beginning and then see if it works. And check code is in the correct sheet module.

Application.EnableEvents = True
0
 
StephenJRCommented:
Works for me when I type something into F6. Could events have been turned off?
0
 
bearblackGlobal Program ManagerAuthor Commented:
where would that be?
0
 
bearblackGlobal Program ManagerAuthor Commented:
that worked thanks -- Can you call a sub from this as well or does all your code you want to use be inserted in the private sub
0
 
StephenJRCommented:
No, you can call subs from that code. Might be best now to remove that enablevents line.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.