NativeExcel 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]
Property FormulaHidden As Boolean
[C#]
bool FormulaHidden { get; set; }
[C++]
__property bool get_FormulaHidden();
__property void set_FormulaHidden(bool );
[JScript]
function get FormulaHidden() : bool
function set FormulaHidden(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;
[Visual Basic]
 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