Class Watch (Excel VBA)

The class Watch represents a range that is tracked when the worksheet is recalculated. The Watch object allows users to verify the accuracy of their models and debug problems that they encounter. To use a Watch class variable it first needs to be instantiated, for example


Dim wtc as Watch
Set wtc = Application.Watches(Index:=1)

For Each

Here is an example of processing the Watch items in a collection.


Dim wtcWatche As Watch
For Each wtcWatche In Application.Watches
	
Next wtcWatche

Delete

Deletes the object.


Application.Watches(1).Delete

Source

Returns a Variant value that represents the unique name that identifies items that have a SourceType property value of xlSourceRange, xlSourceChart, xlSourcePrintArea, xlSourceAutoFilter, xlSourcePivotTable, or xlSourceQuery. Possible return values are xlSourceAutoFilter - An AutoFilter range, xlSourceChart - A chart, xlSourcePivotTable - A PivotTable report, xlSourcePrintArea - A range of cells selected for printing, xlSourceQuery - A query table (external data range), xlSourceRange - A range of cells, xlSourceSheet - An entire worksheet, xlSourceWorkbook - A workbook.

If the SourceType property is set to xlSourceRange, this property returns a range, which can be a defined name. If the SourceType property is set to xlSourceChart, xlSourcePivotTable, or xlSourceQuery, this property returns the name of the object, such as a chart name, a PivotTable report name, or a query table name.


Dim xstSource As XlSourceType
xstSource = Application.Watches(1).Source