ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,832
- Office Version
- 2007
- Platform
- Windows
Afternoon,
Ive got a userform which is working well but struggling to load an image when text boxes are filled with data from combobox selection.
Ive used a code taken from another page but need help please on correctly adding the path to where the images are stored.
This is the path for where the images are.
DESKTOP,REMOTES,LOCK PICKING IMAGES
Now when i make a selection from the combobox not only does the text boxes get entered with the correct data but also an image.
I have supplied the code in use below.
Many thanks
Ive got a userform which is working well but struggling to load an image when text boxes are filled with data from combobox selection.
Ive used a code taken from another page but need help please on correctly adding the path to where the images are stored.
This is the path for where the images are.
DESKTOP,REMOTES,LOCK PICKING IMAGES
Now when i make a selection from the combobox not only does the text boxes get entered with the correct data but also an image.
I have supplied the code in use below.
Code:
Private Sub ComboBox1_DropButt*******()Dim i As Long, LastRow As Long
LastRow = Sheets("INFO").Range("BC" & Rows.Count).End(xlUp).Row
If Me.ComboBox1.ListCount = 0 Then
For i = 2 To LastRow
Me.ComboBox1.AddItem Sheets("INFO").Cells(i, "BC").Value
Next i
End If
End Sub
Private Sub ComboBox1_Change()
Dim i As Long, LastRow As Long
LastRow = Sheets("INFO").Range("BC" & Rows.Count).End(xlUp).Row
For i = 2 To LastRow
If Sheets("INFO").Cells(i, "BC").Value = (Me.ComboBox1) Or _
Sheets("INFO").Cells(i, "BC").Value = Val(Me.ComboBox1) Then
Me.TextBox1 = Sheets("INFO").Cells(i, "BE").Value
Me.TextBox2 = Sheets("INFO").Cells(i, "BG").Value
Me.TextBox3 = Sheets("INFO").Cells(i, "BI").Value
Me.TextBox4 = Sheets("INFO").Cells(i, "BK").Value
Me.TextBox5 = Sheets("INFO").Cells(i, "BM").Value
Me.TextBox6 = Sheets("INFO").Cells(i, "BO").Value
Me.TextBox7 = Sheets("INFO").Cells(i, "BS").Value
Me.TextBox8 = Sheets("INFO").Cells(i, "BQ").Value
Me.TextBox9 = Sheets("INFO").Cells(i, "BU").Value
End If
Next
End Sub
Private Sub KeyType_Change()
If (Me.TextBox1.Value) = "" Then
Me.Image1.Picture = LoadPicture(ThisWorkbook.Path & "\dr-logo.jpg")
Else
Image1.Picture = LoadPicture(ThisWorkbook.Path & "\" & HondaPartNumber.Value & ".jpg")
End If
End Sub
Many thanks