Partager via


Watches.Add Method (Excel)

Adds a range which is tracked when the worksheet is recalculated.

Syntax

expression .Add(Source)

expression A variable that represents a Watches object.

Parameters

Name

Required/Optional

Data Type

Description

Source

Required

Variant

The source for the range.

Return Value

A Watch object that represents the new range.

Example

This example creates a summation formula in cell A3 and then adds this cell to the watch facility.

Sub AddWatch() 
 
 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 
 
End Sub

See Also

Concepts

Watches Object

Watches Object Members