Share via


NamedRange.FormulaHidden Property (2007 System)

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

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public Property FormulaHidden As Object
'Usage
Dim instance As NamedRange 
Dim value As Object 

value = instance.FormulaHidden

instance.FormulaHidden = value
[BrowsableAttribute(false)]
public Object FormulaHidden { get; set; }
[BrowsableAttribute(false)]
public:
property Object^ FormulaHidden {
    Object^ get ();
    void set (Object^ value);
}
public function get FormulaHidden () : Object 
public function set FormulaHidden (value : Object)

Property Value

Type: System.Object
true if the formula will be hidden when the worksheet is protected; nulla null reference (Nothing in Visual Basic) if the NamedRange control contains some cells with FormulaHidden equal to true and some cells with FormulaHidden equal to false.

Remarks

Do not confuse this property with the Hidden property. The formula will not be hidden if the workbook is protected and the worksheet is not.

Examples

The following code example sets the Formula property of a NamedRange control to calculate the sum of cells A1 through A5, uses the FormulaHidden property to hide the formula, and then calls the Calculate method to calculate the sum of the cells and place the sum in cell A6.

This example is for a document-level customization.

Private Sub CalculateRange()
    Dim namedRange1 As Microsoft.Office.Tools.Excel.NamedRange _
        = Me.Controls.AddNamedRange(Me.Range("A1", "A5"), _
        "namedRange1")

    Dim namedRange2 As Microsoft.Office.Tools.Excel.NamedRange _
        = Me.Controls.AddNamedRange(Me.Range("A6"), _
        "namedRange2")

    namedRange1.Value2 = 5
    namedRange2.Formula = "=SUM(A1:A5)"
    namedRange2.FormulaHidden = True
    namedRange2.Calculate()
End Sub
private void CalculateRange()
{
    Microsoft.Office.Tools.Excel.NamedRange namedRange1 =
        this.Controls.AddNamedRange(this.Range["A1", "A5"],
        "namedRange1");

    Microsoft.Office.Tools.Excel.NamedRange namedRange2 =
        this.Controls.AddNamedRange(this.Range["A6", missing],
        "namedRange2");

    namedRange1.Value2 = 5;
    namedRange2.Formula = "=SUM(A1:A5)";
    namedRange2.FormulaHidden = true;
    namedRange2.Calculate();
}

.NET Framework Security

See Also

Reference

NamedRange Class

NamedRange Members

Microsoft.Office.Tools.Excel Namespace