Class Watches (Excel VBA)
A collection of all the Watch objects in a specified application. To use a Watches class variable it first needs to be instantiated, for example
Dim wtcs as Watches
Set wtcs = Application.Watches
For Each
Here is an example of processing the Watches items in a collection.
Dim wtcWatche As Watch
For Each wtcWatche In Application.Watches
Next wtcWatche
Add
Adds a range that is tracked when the worksheet is recalculated.
Add (Source)
Source: The source for the range.
With Application
.Range("A1").Formula = 1
.Range("A2").Formula = 2
.Range("A3").Formula = "=Sum(A1:A2)"
.Range("A3").Select
.Watches.Add Source:=ActiveCell
End With
Count
Returns a Long value that represents the number of objects in the collection.
Dim lngCount As Long
lngCount = Application.Watches.Count
Delete
Deletes the object.
Application.Watches.Delete
Item
Returns a single Watch object from the collection.
Item (Index)
Index: The name or index number of the object.
Dim wtcItem As Watch
Set wtcItem = Application.Watches(Index:=1)