Referencing an image name by cell value

Phox

Well-known Member
Joined
Jul 26, 2004
Messages
522
I have a userform with an image named "California".
The image is defaulted to be invisible.
I would like the image to become visible if the value of Range E1 is "California".

This is what I tried to do but it didnt work.

If Range("E1").Value = "California" Then
Range("E1").Value.Visible = True
End If

Can somebody please help me out?
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Hello, Phox,
Try this:
Code:
Private Sub userform_initialize()
If Range("E1") = "California" Then
Me.Controls(Range("E1").Value).Visible = True
End If
End Sub

this works for me

regards,
Erik
 
Upvote 0
Thanks, that works for what I need.

Just more a better understanding though, could you explain to me a little about Me.Controls? What it does, other likely applications for it, etc?

Thanks a ton!
 
Upvote 0

Forum statistics

Threads
1,202,923
Messages
6,052,581
Members
444,593
Latest member
Smaxls

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