Freigeben über


WorksheetBase.Visible Property

Definition

Gets or sets a XlSheetVisibility value that determines whether the object is visible.

public:
 property Microsoft::Office::Interop::Excel::XlSheetVisibility Visible { Microsoft::Office::Interop::Excel::XlSheetVisibility get(); void set(Microsoft::Office::Interop::Excel::XlSheetVisibility value); };
public Microsoft.Office.Interop.Excel.XlSheetVisibility Visible { get; set; }
member this.Visible : Microsoft.Office.Interop.Excel.XlSheetVisibility with get, set
Public Property Visible As XlSheetVisibility

Property Value

One of the XlSheetVisibility values.

Examples

The following code example uses the Visible property to help select the range of used cells on a worksheet. The example first sets the range of cells from A1 to C3 on the current worksheet to the value 23. If the Visible property indicates that the worksheet is visible, then the example uses the UsedRange property to select the Microsoft.Office.Interop.Excel.Range of used cells.

This example is for a document-level customization.

private void SelectUsedRange()
{
    this.Activate();
    this.Range["A1", "C3"].Value2 = 23;
    if (this.Visible == Excel.XlSheetVisibility.xlSheetVisible)
    {
        this.UsedRange.Select();
    }
}
Private Sub SelectUsedRange()
    Me.Activate()
    Me.Range("A1", "C3").Value2 = 23
    If Me.Visible = Excel.XlSheetVisibility.xlSheetVisible Then
        Me.UsedRange.Select()
    End If
End Sub

Applies to