1 Reply Latest reply on Mar 28, 2018 7:29 AM by Eugene Lee

    Trigger VBA Worksheet_Change event on Pi Data link values fetch.

    UmerFarooq

      I want to trigger VBA worksheet change event, when pi data link changes values in the excel sheet. Worksheet_change method triggers when values entered manually or through VBA script in the sheet but function WorkSheet_Change function is not getting called when sheet is being populated thought PI Data Link.

       

      The reason, I want to do this is because, when ever pi data link updates, workSheet_Change triggers the alarm with Beep function.

      if not possible this way, Kinldy, advice how it can be achieved by the other way around...

       

      Please see the VBA Script.

      Private Sub Worksheet_Change(ByVal Target As Range)

          Dim KeyCells As Range

          Set KeyCells = Range("T10", ActiveSheet.Range("S10").End(xlDown))

          Set KeyCells1 = Range("W10", ActiveSheet.Range("W10").End(xlDown))

         

          If Not Application.Intersect(KeyCells, Range(Target.Address)) _

                 Is Nothing Then

              MsgBox "Cell " & Target.Address & " has changed."

              ActiveSheet.Range("T10", ActiveSheet.Range("S10").End(xlDown)).Select

              Beep

              'This is not getting called.

          End If

         

         

          If Not Application.Intersect(KeyCells1, Range(Target.Address)) _

                 Is Nothing Then

              MsgBox "Cell " & Target.Address & " has changed."

             

          End If

         

      End Sub

       

      PI datalink file is attached in the attachment.