本文由日文译成中文。

这是用 Excel VBA 在工作表上显示和隐藏图像和形状(自动形状)的记录。

使用 “可见 ”属性显示或隐藏图像。

< Sponsored Links >





显示和隐藏图像和数字的示例

展示

显示图像和形状(自动形状)。

Sub test()
    Dim shp As Shape
    Set shp = ActiveSheet.Shapes(1)

    With shp
        .Visible = True
    End With
End Sub
visible
visible

 

不显示

隐藏图像和形状(自动形状)。

Sub test()
    Dim shp As Shape
    Set shp = ActiveSheet.Shapes(1)

    With shp
        .Visible = False
    End With
End Sub
visible
visible

 

如果不使用 “With” 语句。

ActiveSheet.Shapes(1).Visible = True

< Sponsored Links >