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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
StephenJRCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.