What you're saying is that you only want to trigger a UDF() if a value actually changes to a different value, not if it changes to the same value.
I've never heard of a way to tell Excel to not trigger a UDF() if the new value is the same as the old value. As far as I know you have to store the old value and compare the new value to the old value.
The UDF() could be made faster by having it trigger just once for the entire 1000 rows and keep the old values in memory instead of on a worksheet. So at least it doesn't take the time to save the values to disk.
Sub Trigger(ByVal r as Range)
Static aOldValues
Dim aNewValues
Dim lRow as Long, lCol as Long
If uBound(aOldValues,1) <= 0 Then
aOldValues = r.Value
Else
aNewValues = r.Value
For lRow = 1 to r.Rows.Count
For lCol = 1 to r.Columns.Count
If aNewValues(lRow, lCol) <> aOldValues(lRow, lCol) Then
MsgBox "Success"
aOldValues = aNewValues
Exit Sub
End If
Next lCol
Nes lRow
End If
End Sub
Bookmarks