The Formula property

The Formula property represents the formula in a cell. This is a read-write property, so you can access it to insert a formula into a cell. For example, the following statement enters a SUM formula into cell A13:

Range("A13").Formula = "=SUM(A1:A12)"

Notice that the formula is a text string and is enclosed in quotation marks. You can access a cell's Formula property even if the cell doesn't have a formula. If you are using the Formula property to determine the formula already in a cell and the cell doesn't have a formula, the Formula property returns the cell's Value property. You can also use the HasFormula property to determine if a cell contains a formula.

0 0

Post a comment