NativeExcel2 for .Net Developer's Reference

IRange.FormulaHidden Property

Gets or sets a value that indicates whether the formula in the range will be hidden when the worksheet is protected.

[Visual Basic]
PropertyFormulaHiddenAsBoolean
[C#]
boolFormulaHidden{get;set;}
[C++]
__propertyboolget_FormulaHidden();
__propertyvoidset_FormulaHidden(bool);
[JScript]
functiongetFormulaHidden():bool
functionsetFormulaHidden(bool);

Property Value

true if the formula will be hidden when the worksheet is protected; otherwise, false.

Remarks

The formula will not be hidden if the workbook is protected and the worksheet is not, but only if the worksheet is protected.

Example

This example sets the formula of cell A6 to calculate the sum of cells A1 through A5, uses the FormulaHidden property to hide the formula.

[C#]
 IRange r = book.Worksheets[1].Range["A6"]; 
 r.Value = "=SUM(A1:A5)";
 r.FormulaHidden = true;
[VisualBasic]
 Dim r As IRange = book.Worksheets(1).Range("A6")
 r.Value = "=SUM(A1:A5)"
 r.FormulaHidden = True
[C++]
 IRange* r = book->Worksheets->Item[1]->Range->Item[S"A6"]; 
 r->Value = S"=SUM(A1:A5)";
 r->FormulaHidden = true;

See Also

IRange Interface | NativeExcel Namespace