Hi, I am new to VBA and trying to create a macro that triggers when a value in column A changes. My worksheet data is referenced from another worksheet and set to refresh every day. The problem I am encountering is when the worksheet refreshes even if no changes have occurred my worksheet change macro is triggering. I need it to trigger but only if one of the refreshed values has changed. Is this possible?
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim xRgSel As Range
Dim xOutApp As Object
Dim xMailItem As Object
Dim xMailBody As String
On Error Resume Next
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False
Set xRg = Range("A1", Range("A1").End(xlDown))
Set xRgSel = Intersect(Target, xRg)
ActiveWorkbook.Save
If Not xRgSel Is Nothing Then
MsgBox "Updated"
End If
Application.EnableEvents = True
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub