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

后端 未结 4 632
佛祖请我去吃肉
佛祖请我去吃肉 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:20

    Sub hidePicture(myImage)
        ActiveSheet.Shapes.Range(Array(myImage)).Select
        Selection.ShapeRange.Height = 0
        Selection.ShapeRange.Width = 0
    End Sub
    
    Sub showPicture(myImage)
        ActiveSheet.Shapes.Range(Array(myImage)).Select
        Selection.ShapeRange.Height = 200
        Selection.ShapeRange.Width = 300
    End Sub
    

    Handy tip: record macro and look at the code it generates!

提交回复
热议问题