Image visible

SPLUCENA

Board Regular
Joined
Feb 24, 2009
Messages
189
Hi All,

Kindly forgive my programming, I have been playing with this code but cannot do the right syntax. I want the image to remain hidden until chosen so I put this code but I am not getting it. What is the right way of writing the code? Kindly help....
Code:
Private Sub ComboBox1_Change()

    Dim ProdFound As Range
    [COLOR=Red]Image.Visible = False[/COLOR]
    With Worksheets("1L").Range("A:A")
        Set ProdFound = .Find(ComboBox1.Value, LookIn:=xlValues)
        If ProdFound Is Nothing Then
            MsgBox ("ITEM NOT FOUND!")
            ComboBox1.Value = ""
            Exit Sub
        Else
            With Range(ProdFound.Address)
            Label2 = .Offset(0, 1)
            Label3 = .Offset(0, 2)
            Label4 = .Offset(0, 3)
            Label5 = .Offset(0, 4)
            Label6 = .Offset(0, 5)
            Label7 = .Offset(0, 6)
            Label8 = .Offset(0, 7)
            Label9 = .Offset(0, 8)
            Label10 = .Offset(0, 9)
            Label11 = .Offset(0, 10)
            Label12 = .Offset(0, 11)
            Label13 = .Offset(0, 12)
            Label40 = .Offset(0, 15)
            Label40.BackColor = RGB(255, 255, 0)
            
            On Error Resume Next
           [COLOR=Red] Image.Visible = True[/COLOR]
            Image1.Picture = LoadPicture _
            ("C:\Documents and Settings\NOEL\Desktop\PHOTO2\" & ProdFound & ".jpg")
            On Error GoTo 0
            End With
        End If
    End With

End Sub

thanks,
splucena
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Hi Splucena,

This should probably be obvious to me, but is this in a userform, or is all this on a sheet?

Mark
 
Upvote 0
Hi Splucena,

If I understand the initial challenge - it is to get the userform going with no pic on display. If this is correct, I would use the form's initialize event, or activate event if you hide the form (w/o unloading) and later redisplay w/o selections being maintained.

Anyways, try either:

Code:
Private Sub UserForm_Initialize()
    With Me
        .imgOptionalPic.Picture = LoadPicture("")
        
        'OR
        
        .imgOptionalPic.Visible = False
    End With
End Sub

Personally, I think I would try setting LoadPicture, and not worry about setting the control's visibility.

Hope this helps,

Mark
 
Upvote 0

Forum statistics

Threads
1,207,387
Messages
6,078,200
Members
446,321
Latest member
thecachingyeti

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