(Excel VBA) If Cell Value equals “” Then Show/Hide Images

后端 未结 4 627
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-12 15:31

I am working on a Excel Spreadsheet that when a dropdown box value is selected an image will pop up, and if another value is selected it will hide the current image and pop

4条回答
  •  借酒劲吻你
    2021-01-12 16:19

    Might be better just to move your pictures "off screen", particularly if they're of different sizes.

    Sub Tester()
        ShowPicture "Picture 3"
    End Sub
    
    Sub ShowPicture(PicName As String)
    
        Dim s As Shape
        For Each s In ActiveSheet.Shapes
            With s
            .Top = IIf(.Name = PicName, 100, 100)
            .Left = IIf(.Name = PicName, 100, 1000)
            End With
        Next s
    
    End Sub
    

提交回复
热议问题