Msgbox

SPLUCENA

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

Why my msgbox is not appearing when a certain product is not found? Is there something missing with the code? Kindly assist.
Code:
Private Sub ComboBox1_Change()

    Dim ProdFound As Range
    With Worksheets("1L").Range("A:A")
        Set ProdFound = .Find(ComboBox1.Value)
        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)
            'Label14 = .Offset(0, 13)
            'Label15 = .Offset(0, 14)
            'Label16 = .Offset(0, 15)
            'Label17 = .Offset(0, 16)
            
            
            On Error Resume Next
            Image1.Picture = LoadPicture _
            ("C:\Documents and Settings\NOEL\Desktop\PHOTO2\" & ProdFound & ".jpg")
            On Error GoTo 0
            End With
        End If
    End With


thanks,

splucena
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Try this :

Replace ...

Code:
Set ProdFound = .Find(ComboBox1.Value)

... with ...

Code:
Set ProdFound = .Find(ComboBox1.Value, lookin:=xlValues)

Erik
 
Upvote 0

Forum statistics

Threads
1,214,830
Messages
6,121,831
Members
449,051
Latest member
excelquestion515

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