Active X Control Combo Box to give result in cell. Then VBA VLookup to place notes image in cell but does not work how I need it to

CrustyR1

New Member
Joined
May 23, 2014
Messages
31
Hi All, hopeflully someone can help with this one.

I have a sheet (Entry Form) that has a Active X combo Box C35 ("1 Door Base" - which doesn't show ) which works well and gives result in linked cell E35. I have a VBA VLookup looking at sheet 2 (Images) to find the match in E35 and show a notes image in F35. This all seems to work however I have to select E35, click on formula bar which is text only and then hit enter. After this the notes image and text "image" shows. I would like to be able to have the notes image show without the click & enter in formula bar as column E in grey gets hidden.

For some reason there is a need to select E35 call / formula bar for it to work. Auto calc is on and double clicking in E35 does nothing.

Cabinet Order Form_V6_WIP_3.xlsm
BCDEF
33Line NoCabinet TypeCabinet Code
34
351 1 Door BaseImage
362 1 Door BaseImage
373 2 Door BaseImage
384 1 Door BaseImage
395
406
417
428
439
4410
Entry Form
 

Attachments

  • IMG_3014.jpg
    IMG_3014.jpg
    107.1 KB · Views: 11

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Lookup code

Private Sub Worksheet_Change(ByVal target As Range)
Dim cell As Range, vFND As Range

On Error GoTo ErrorExit
For Each cell In target
If cell.Column = 5 Then 'only cells in column E
Application.EnableEvents = False
With Sheets("Images")
On Error Resume Next
Set vFND = .Range("A:A").Find(cell, LookIn:=xlValues, LookAt:=xlWhole)
On Error GoTo ErrorExit
If Not vFND Is Nothing Then
vFND.Offset(, 1).Copy cell.Offset(, 1)
Else
cell.Offset(, 1) = ""
End If
End With

End If
Next cell

ErrorExit:
Application.EnableEvents = True
End Sub
 
Upvote 0
The linked cell wont cause the worksheet_change macro to trigger. You will have to use a combobox_change event in the sheet module.
 
Upvote 0
The linked cell wont cause the worksheet_change macro to trigger. You will have to use a combobox_change event in the sheet module.
Thanks Steve the fish. I’ve placed a combobox change event for combobox that’s in row 35 but does nothing..... I may be doing it wrong though. Are you able to offer further advice?
Cheers
 
Upvote 0
Can you rephrase again. What is the lookup value? Is it the combobox value? If so how are you changing the combobox? Where is it to look for the combobox value? When it finds it what do you want to produce?
 
Upvote 0
Ill take a stab at it? This maybe:

VBA Code:
Private Sub ComboBox1_Change()

Dim cell As Range, vFND As Range

Set cell = Me.Range(ComboBox1.LinkedCell)

With Sheets("Images")
    Set vFND = .Range("A:A").Find(ComboBox1.Value, LookIn:=xlValues, LookAt:=xlWhole)
    If Not vFND Is Nothing Then
        vFND.Offset(, 1).Copy cell.Offset(, 1)
    Else
        cell.Offset(, 1) = ""
    End If
End With

End Sub
 
Upvote 0
Ill take a stab at it? This maybe:

VBA Code:
Private Sub ComboBox1_Change()

Dim cell As Range, vFND As Range

Set cell = Me.Range(ComboBox1.LinkedCell)

With Sheets("Images")
    Set vFND = .Range("A:A").Find(ComboBox1.Value, LookIn:=xlValues, LookAt:=xlWhole)
    If Not vFND Is Nothing Then
        vFND.Offset(, 1).Copy cell.Offset(, 1)
    Else
        cell.Offset(, 1) = ""
    End If
End With

End Sub
Thanks I’ll try that. I’m not a code writer...... I googled to find how to insert an image in notes of what had been selected in the combobox. Basically if the user selected 1 door cupboard in B35 combobox then this image would show in F35 as a note. If a 2 door cupboard is selected in B35 combobox then the image changes to a 2 door cupboard & so on. Tried to show this in attached pic. It all worked OK except the note/image doesn’t populate unless I put mouse curser in formula bar & hit enter..... then it appeared.
 
Upvote 0
Thats just because you have no trigger to fire the code into action. The combobox change will act as a trigger. Or your original code would trigger if you changed the cells yourself rather than asking the combobox to change them which is what you are doing by reinputting them.
 
Upvote 0

Forum statistics

Threads
1,215,006
Messages
6,122,666
Members
449,091
Latest member
peppernaut

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