I cannot run Private Sub Worksheet_Change(ByVal Target As Range) [Closed]

Report
-
Hello,

i am trying to run the below code,

Private Sub Worksheet_Change(ByVal Target As Range)
Dim selectedValue As String
Dim templateValues As String
Dim fileLocation As String
Dim personName As String
Dim Subject As String


selectedValue = ActiveCell.Formula

On Error GoTo SubEnd
templateValues = Application.WorksheetFunction.VLookup(selectedValue, Sheets("Template").Range("A1:A30"), 1, False)
fileLocation = Application.WorksheetFunction.VLookup(selectedValue, Sheets("Template").Range("A1:B30"), 2, False)
Subject = Application.WorksheetFunction.VLookup(selectedValue, Sheets("Template").Range("A1:C30"), 3, False)
personName = Cells(Application.ActiveCell.Row, 6).Value & " " & Cells(Application.ActiveCell.Row, 7).Value

If selectedValue = templateValues Then
Call Client_Mails(fileLocation, Subject)
Call Oltask(selectedValue, personName)

End If
SubEnd:
End Sub

But the code is not running,can i know how to fix it.

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!