Skip to content
本页内容

Visible (属性)

返回或设置一个 XlSheetVisibility 值,它确定对象是否可见。

示例

python
#本示例隐藏 Sheet1
def test():
    Application.Worksheets.Item("Sheet1").Visible = False
python
#本示例将 Sheet1 设置为可见
def test():
    Application.Worksheets.Item("Sheet1").Visible = True
python
#本示例使活动工作簿中的每一张工作表可见
def test():
    for i in range(1, Sheets.Count):
        Application.Sheets.Item(i).Visible = True
python
#本示例新建一张工作表,然后将其 Visible 属性设为 xlSheetVeryHidden 要引用该工作表,可使用其对象变量 newSheet,如本示例最后一行所示
def test():
    newSheet = Application.Worksheets.Add()
    newSheet.Visible = xlSheetVeryHidden
    newSheet.Range("A1:D4").Formula = "=RAND()"