Gets a value that indicates whether at least one cell in the range contains a formula.
[Visual Basic] Property ReadOnly HasFormula As Boolean [C#] bool HasFormula { get; } [C++] __property bool get_HasFormula(); [JScript] function get HasFormula() : bool
true if at least one cell in the range contains a formula; otherwise, false.
The following example checks whether the cell A3 contains a formula
[C#]
IRange cell = book.Worksheets[1].Range["A3"];
if (cell.HasFormula) {
//do something
}
[Visual Basic]
Dim cell As IRange
cell = book.Worksheets(1).Range("A3")
If (cell.HasFormula) Then
'do something
End If
[C++]
IRange* cell;
cell = book->Worksheets->Item[1]->Range->Item[S"A3"];
if (cell->HasFormula) {
//do something
}
The following example checks whether the worksheet one contains a formula [C#]
if (book.Worksheets[1].UsedRange.HasFormula) {
//do something
}
[Visual Basic]
If (book.Worksheets(1).UsedRange.HasFormula) Then
'do something
End If
[C++]
if (book->Worksheets->Item[1]->UsedRange->HasFormula) {
//do something
}
IRange Interface | NativeExcel Namespace | Formula Property