You can use this code
Code:
Private Sub My_Function()
Dim srv As Server
Dim TagName As String
Dim pt As PIPoint
Dim pv As PIvalue
Set srv = Servers("Your_PIserver")
TagName = "cdm158"
Set pt = srv.PIPoints(TagName)
Set pv = pt.Data.Snapshot
Do
If pv.Value <> pt.Data.ArcValue(pv.TimeStamp, rtBefore).Value Then
Exit Do
Else
Set pv = pt.Data.ArcValue(pv.TimeStamp, rtBefore)
End If
Loop Until 1 <> 1
MsgBox "Time changed: " & pv.TimeStamp.LocalDate
End Sub
If at you many identical values in archive it can last long time (about several minutes)
In that case, it is possible to enter restriction on depth of sample of archive. For example if value didn't change 5 days not to continue search, and to tell to the user that value didn't change more than 5 days