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

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Watch MrExcel Video

Forum statistics

Threads
1,129,977
Messages
5,639,350
Members
417,082
Latest member
rbaltero

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
Top