Show different Pictures for different options depending on two list values

goncalocoelho

New Member
Joined
Apr 15, 2020
Messages
9
Office Version
  1. 2016
Platform
  1. Windows
Hi everyone, I would really appreciate if someone could help me with a little problem i'm having.

I'm trying to code an excel sheet to act as a kind of form, and i need to show different pictures that update when i change the list values marked as yellow on the picture below.
The code I currently have on the sheet doesn't seem to work as it gives me a error when i try make a case with the values in Cell G21 (Option1) and O18 (Fixed Window). Is there any other simpler way of doing this?

Thank you all,

VBA Code:
If Not Intersect(Target, Range("G21")) Is Nothing Then

    Select Case Range("G21")
 
        Case "Option1" And Range("O18") = "Fixed Window":
            Call delete_shp2
            Sheets("Imagens").Shapes("fix_1").Copy
            Sheets("Form").Paste
            Set shp3 = Sheets("Form").Shapes("fix_1")
            shp3.Left = Sheets("Form").Range("L20").Left
            shp3.Top = Sheets("Form").Range("L20").Top
            shp3.Height = Sheets("Form").Range("L20:L29").Height
            shp3.LockAspectRatio = msoTrue
            shp3.Visible = msoTrue
            
        Case "Option1" And Range("O18") = "Sliding Window":
            Call delete_shp2
            Sheets("Imagens").Shapes("sld_1").Copy
            Sheets("Form").Paste
            Set shp3 = Sheets("Form").Shapes("sld_1")
            shp3.Left = Sheets("Form").Range("L20").Left
            shp3.Top = Sheets("Form").Range("L20").Top
            shp3.Height = Sheets("Form").Range("L20:L29").Height
            shp3.LockAspectRatio = msoTrue
            shp3.Visible = msoTrue
            
        Case "Option2" And Range("O18") = "Fixed Window":
            Call delete_shp2
            Sheets("Imagens").Shapes("fix_2").Copy
            Sheets("Form").Paste
            Set shp3 = Sheets("Form").Shapes("fix_2")
            shp3.Left = Sheets("Form").Range("L20").Left
            shp3.Top = Sheets("Form").Range("L20").Top
            shp3.Height = Sheets("Form").Range("L20:L29").Height
            shp3.LockAspectRatio = msoTrue
            shp3.Visible = msoTrue
            
        Case "Option2" And Range("O18") = "Sliding Window":
            Call delete_shp2
            Sheets("Imagens").Shapes("sld_2").Copy
            Sheets("Form").Paste
            Set shp3 = Sheets("Form").Shapes("sld_2")
            shp3.Left = Sheets("Form").Range("L20").Left
            shp3.Top = Sheets("Form").Range("L20").Top
            shp3.Height = Sheets("Form").Range("L20:L29").Height
            shp3.LockAspectRatio = msoTrue
            shp3.Visible = msoTrue
    
    End Select
        
End If
1586963176362.png
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Forum statistics

Threads
1,215,514
Messages
6,125,273
Members
449,219
Latest member
daynle

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top