Visible Property

Microsoft Excel Visual Basic

Show All

Visible Property

       

Visible property as it applies to the ChartFillFormat, FillFormat, LineFormat, ShadowFormat, Shape, ShapeRange, and ThreeDFormat objects.

Determines whether the object is visible. Read/write MsoTriState.

MsoTriState can be one of these MsoTriState constants.
msoCTrue
msoFalse
msoTriStateMixed
msoTriStateToggle
msoTrue The object is visible.

expression.Visible

expression   Required. An expression that returns one of the above objects.

 

Visible property as it applies to the Chart and Worksheet objects.

Determines whether the object is visible. Read/write XlSheetVisibility.

XlSheetVisibility can be one of these XlSheetVisibility constants.
xlSheetHidden
xlSheetVisible
xlSheetVeryHidden Hides the object so that the only way for you to make it visible again is by setting this property to True (the user cannot make the object visible).

expression.Visible

expression   Required. An expression that returns one of the above objects.

 

Visible property as it applies to the Application, ChartObject, ChartObjects, Comment, Name, OLEObject, OLEObjects, Phonetic, Phonetics, PivotItem, and Window objects.

Determines whether the object is visible. Read/write Boolean.

expression.Visible

expression   Required. An expression that returns one of the above objects.

 

Visible property as it applies to the Charts, Sheets, and Worksheets objects.

Determines whether the object is visible. Read/write Variant.

expression.Visible

expression   Required. An expression that returns one of the above objects.

 

Remarks

The Visible property for a PivotTable item is True if the item is currently visible in the table.

If you set the Visible property for a name to False, the name won't appear in the Define Name dialog box.

Example

As it applies to the Charts, Sheets, and Worksheets objects.

This example hides Sheet1.

Worksheets("Sheet1").Visible = False

This example makes Sheet1 visible.

Worksheets("Sheet1").Visible = True

This example makes every sheet in the active workbook visible.

For Each sh In Sheets
 sh.Visible = True
Next sh

This example creates a new worksheet and then sets its Visible property to xlVeryHidden. To refer to the sheet, use its object variable, newSheet, as shown in the last line of the example. To use the newSheet object variable in another procedure, you must declare it as a public variable (Public newSheet As Object) in the first line of the module preceding any Sub or Function procedure.

Set newSheet = Worksheets.Add
newSheet.Visible = xlVeryHidden
newSheet.Range("A1:D4").Formula = "=RAND()"