Sort/filter formula used for search formula combobox issue with shorter named values, Formula help for search combobox

Greenbehindthecells

Board Regular
Joined
May 9, 2023
Messages
50
Office Version
  1. 365
Platform
  1. Windows
Hello everyone,

I hope you are well. I have a combobox that is not allowing the selection of a shorter, similarly named but different value... For my purposes, my combobox needs to search for 'ABC' practice... however, possibly due to the generic names of my other practices (ABC GI, ABC Neph, ABC Card, etc) and the formula I used (sort/filter), the combobox does not allow the selection of 'ABC' practice (my sort\filter formula will return the result of all of ABC practices despite any clicking in the combobox of just 'ABC' practice). The formula works for all other practices with longer more distinct value/names (ABC GI, ABC Neph, ABC Card, etc) with no issues.

While I see that this is an issue with the formula in my List tab used to sort/filter the search, I cant figure out a better formula to use for this purpose to get the result in my combobox that when 'ABC' is entered, and it 'ABC' is selected as confirmation, it will populate 'ABC'. I can't change the values/names (for example adding a =char(185) to make the practice names unique because in my real data, I have hundreds of providers for a generic practice name like this for specific locations.

I recreated the original workbook with the settings & VBA I used from various tutorials and added to my post. My data sheet was too large for mini excel so I added a shortened version and a screenshot, hoping to give an idea of the data that should be populated in the combobox. Any assistance would be greatly appreciated. Thank you for your time.

Screenshot of combobox not working with 'ABC' practice name:
1691080610063.png



Combobox working with all other longer names/values:
1691080706109.png



Data sheet:
Combobox.xlsm
ABCDEFGHIJKLMNOP
1GROUP NAMETAX ID (TAB REPORT)NPIPRINT NAMEADDRESS3ADDRESS1ADDRESS2CITYSTATEZIPCOUNTYPHONEFAX (TAB REP MATCH)LANG CONSOLHOURS CONSOLPCP
2ABC9999999991E+10NIEVES, JESUS, DO11 BROADWAY, STE 1111 BROADWAYSTE 11WILMINGTONDE19801NEW CASTLE (F)(999) 999-9991(999) 999-9992GREEK, MANDARINMON: 8:00AM TO 5PM, TUES: 8:00AM TO 5PM, WED: 8:00AM TO 5PM, THURS: 8:00AM TO 5PM, FRI: 8:00AM TO 5PM, SAT: CLOSED, SUN: CLOSEDy
3ABC PEDS9999999991E+10SMITH, JOHN, DO11 BROADWAY, STE 2211 BROADWAYSTE 22WILMINGTONDE19801NEW CASTLE (F)(999) 999-9993(999) 999-9994Not on fileNot on filen
4ABC GI9999999991E+10CARTER, CARTER, DO10 BROADWAY, STE 1110 BROADWAYSTE 11WILMINGTONDE19801NEW CASTLE (F)(999) 999-9995(999) 999-9996SPANISHMON: 8:00AM TO 5PM, TUES: 8:00AM TO 5PM, WED: 8:00AM TO 5PM, THURS: 8:00AM TO 5PM, FRI: 8:00AM TO 5PM, SAT: CLOSED, SUN: CLOSEDn
5ABC CARD9999999991E+10SHIN, XE, DO10 BROADWAY, STE 2210 BROADWAYSTE 22WILMINGTONDE19801NEW CASTLE (F)(999) 999-9997(999) 999-9998RUSSIANMON: 8:00AM TO 5PM, TUES: 8:00AM TO 5PM, WED: 8:00AM TO 5PM, THURS: 8:00AM TO 5PM, FRI: 8:00AM TO 5PM, SAT: 8:00AM TO 5PM, SUN: CLOSEDn
6ABC NEPH9999999991E+10OHNSON, LISA, DO9 BROADWAY, STE 19 BROADWAYSTE 1WILMINGTONDE19801NEW CASTLE (F)(999) 999-9999(999) 999-9910POLISH, PORTEGUESEMON: 8:00AM TO 5PM, TUES: 8:00AM TO 5PM, WED: 8:00AM TO 5PM, THURS: CLOSED, FRI: 8:00AM TO 5PM, SAT: 8:00AM TO 5PM, SUN: CLOSEDn
7BBC8888888881E+10WILLIAMS, MICHAEL, MD11 BROADWAY, STE 111 BROADWAYSTE 1WILMINGTONDE19801NEW CASTLE (F)(110) 000-0001(999) 999-9930TELUGONot on filey
8BBC PEDS8888888881E+10JONES, SARAH, DO11 BROADWAY, STE 211 BROADWAYSTE 2WILMINGTONDE19801NEW CASTLE (F)(110) 000-0002(999) 999-9914HAITIANNot on filen
9BBC GI8888888881E+10BROWN, ROBERT, MD10 BROADWAY, STE 310 BROADWAYSTE 3WILMINGTONDE19801NEW CASTLE (F)(110) 000-0003(999) 999-9898DUTCHMON: 8:00AM TO 5PM, TUES: 8:00AM TO 5PM, WED: 8:00AM TO 5PM, THURS: 8:00AM TO 5PM, FRI: 8:00AM TO 5PM, SAT: CLOSED, SUN: CLOSEDn
10BBC CARD8888888881E+10DAVIS, MARY, DO10 BROADWAY, STE 410 BROADWAYSTE 4WILMINGTONDE19801NEW CASTLE (F)(110) 000-0004(999) 999-9882GREEK, MANDARINMON: 8:00AM TO 5PM, TUES: 8:00AM TO 5PM, WED: 8:00AM TO 5PM, THURS: 8:00AM TO 5PM, FRI: 8:00AM TO 5PM, SAT: 8:00AM TO 5PM, SUN: CLOSEDn
11BBC NEPH8888888881E+10MILLER, JAMES, MD9 BROADWAY, STE 59 BROADWAYSTE 5WILMINGTONDE19801NEW CASTLE (F)(110) 000-0005(999) 999-9866Not on fileMON: 8:00AM TO 5PM, TUES: 8:00AM TO 5PM, WED: 8:00AM TO 5PM, THURS: CLOSED, FRI: 8:00AM TO 5PM, SAT: 8:00AM TO 5PM, SUN: CLOSEDn
12CBC7777777771E+10WILSON, JENNIFER, MD22 BROADWAY, STE 10122 BROADWAYSTE 101WILMINGTONDE19801NEW CASTLE (F)(110) 000-0006(999) 999-9862SPANISHNot on filey
13CBC PEDS7777777771E+10MOORE, DAVID, DO22 BROADWAY, STE 10222 BROADWAYSTE 102WILMINGTONDE19801NEW CASTLE (F)(110) 000-0007(999) 999-9851RUSSIANNot on filen
14CBC GI7777777771E+10TAYLOR, LINDA, MD33 BROADWAY, STE 333 BROADWAYSTE 3WILMINGTONDE19801NEW CASTLE (F)(110) 000-0008(999) 999-9840POLISH, PORTEGUESEMON: 8:00AM TO 5PM, TUES: 8:00AM TO 5PM, WED: 8:00AM TO 5PM, THURS: 8:00AM TO 5PM, FRI: 8:00AM TO 5PM, SAT: CLOSED, SUN: CLOSEDn
15CBC CARD7777777771E+10ANDERSON, MARK, MD44 BROADWAY, STE 9644 BROADWAYSTE 96WILMINGTONDE19801NEW CASTLE (F)(110) 000-0009(999) 999-9829TELUGOMON: 8:00AM TO 5PM, TUES: 8:00AM TO 5PM, WED: 8:00AM TO 5PM, THURS: 8:00AM TO 5PM, FRI: 8:00AM TO 5PM, SAT: 8:00AM TO 5PM, SUN: CLOSEDn
16CBC NEPH7777777771E+10THOMAS, ELIZABETH, DO55 BROADWAY, STE 19555 BROADWAYSTE 195WILMINGTONDE19801NEW CASTLE (F)(110) 000-0010(999) 999-9819HAITIANMON: 8:00AM TO 5PM, TUES: 8:00AM TO 5PM, WED: 8:00AM TO 5PM, THURS: CLOSED, FRI: 8:00AM TO 5PM, SAT: 8:00AM TO 5PM, SUN: CLOSEDn
17DBC6666666661E+10JACKSON, CHARLES, MD33 BROADWAY, STE 1133 BROADWAYSTE 11WILMINGTONDE19801NEW CASTLE (F)(110) 000-0011(999) 999-9808DUTCHNot on filey
18DBC PEDS6666666661E+10WHITE, MARIA, MD33 BROADWAY, STE 1233 BROADWAYSTE 12WILMINGTONDE19801NEW CASTLE (F)(110) 000-0012(999) 999-9797GREEK, MANDARINNot on filen
19DBC GI6666666661E+10HARRIS, MATTHEW, DO33 BROADWAY, STE 333 BROADWAYSTE 3WILMINGTONDE19801NEW CASTLE (F)(110) 000-0013(999) 999-9786Not on fileMON: 8:00AM TO 5PM, TUES: 8:00AM TO 5PM, WED: 8:00AM TO 5PM, THURS: 8:00AM TO 5PM, FRI: 8:00AM TO 5PM, SAT: CLOSED, SUN: CLOSEDn
20DBC CARD6666666661E+10MARTIN, SUSAN, MD33 BROADWAY, STE 633 BROADWAYSTE 6WILMINGTONDE19801NEW CASTLE (F)(110) 000-0014(999) 999-9775SPANISHMON: 8:00AM TO 5PM, TUES: 8:00AM TO 5PM, WED: 8:00AM TO 5PM, THURS: 8:00AM TO 5PM, FRI: 8:00AM TO 5PM, SAT: 8:00AM TO 5PM, SUN: CLOSEDn
21DBC NEPH6666666661E+10THOMPSON, PAUL, MD33 BROADWAY, STE 1533 BROADWAYSTE 15WILMINGTONDE19801NEW CASTLE (F)(110) 000-0015(999) 999-9764RUSSIANMON: 8:00AM TO 5PM, TUES: 8:00AM TO 5PM, WED: 8:00AM TO 5PM, THURS: CLOSED, FRI: 8:00AM TO 5PM, SAT: 8:00AM TO 5PM, SUN: CLOSEDn
DD SS NN FF Main
Cell Formulas
RangeFormula
N2:N21N2=IF(AND([@LANG1]=0,[@LANG2]=0,[@LANG3]=0,[@LANG4]=0,[@LANG5]=0,[@LANG6]=0),"Not on file",TEXTJOIN(", ",TRUE,NewPract[@[LANG1]:[LANG6]]))
O2:O21O2=IF(AND( [@MON]=0,[@TUE]=0,[@WED]=0,[@THUR]=0,[@FRI]=0,[@SAT]=0,[@SUN]=0), "Not on file",TEXTJOIN(", ",TRUE,"MON: "&[@MON], "TUES: "&[@TUE],"WED: "&[@WED],"THURS: "&[@THUR],"FRI: "&[@FRI],"SAT: "&[@SAT], "SUN: "&[@SUN]))
E2:E21E2=TEXTJOIN(", ",TRUE,[@ADDRESS1],[@ADDRESS2])

1691080350155.png


VBA code used for combobox:
Private sub Tempbox 4_change ()
Tempbox 4.listfillrange = "Dropdown1"
Me.Tempbox4.Dropdown
End Sub

List sheet with search formula linked to d2/Combobox in Practice Search v2 sheet:
Combobox.xlsm
ABCDEFGHIJ
1ResponsePraticesSearchable
2YesABCABC
3NoABC PEDSABC CARD
4UnkownABC GIABC GI
5ABC CARDABC NEPH
6ABC NEPHABC PEDS
7BBC
8BBC PEDS
9BBC GI
10PCPPapsBBC CARD
11YesBBC NEPH
12NoCBC
13UnkownCBC PEDS
14Specific Provider OnlyCBC GI
15CBC CARD
16CBC NEPH
17DBC
18DBC PEDS
19DBC GI
20DBC CARD
21DBC NEPH
22
23
24
25
List
Cell Formulas
RangeFormula
E2:E6E2=SORT(FILTER(Practices6[#Data],ISNUMBER(SEARCH('Practice Details V2'!$D$2,Practices6[#Data])),"Not found"))
Dynamic array formulas.


Practice Details V2 (Combobox) sheet
Combobox.xlsm
ABCDEFIJMNOPQRSTUVWXYZ
1ContactHours
2abcformula from other sheetMON: 8:00AM TO 5PM, TUES: 8:00AM TO 5PM, WED: 8:00AM TO 5PM, THURS: 8:00AM TO 5PM, FRI: 8:00AM TO 5PM, SAT: CLOSED, SUN: CLOSED
3
4
5
6TaxNPIProvAddressesCityStatePhoneFax
7make a selectionmake selection in fieldmake selection in fieldCounty Health Dept
8formula from other sheet
9
10
11
12
13
14Misc Notes
15formula from other sheet
16
17
18
19P?POC?
20formula from other sheetformula from other sheet
21
22
23
24LanguagesAcron
25make Selection in fieldMake selection field
26
27
28
29
30
31
32
33
Practice Details V2
Cell Formulas
RangeFormula
N2N2=IFERROR(INDEX(NewPract[#Data],MATCH($D$2,NewPract[GROUP NAME],0),15)," ")
B7B7=IFERROR(FILTER(UNIQUE(IF(FILTER(NewPract[TAX ID (TAB REPORT)],EXACT(NewPract[GROUP NAME],$D$2))=0,"No Data",FILTER(NewPract[TAX ID (TAB REPORT)],EXACT(NewPract[GROUP NAME],$D$2)))),UNIQUE(IF(FILTER(NewPract[TAX ID (TAB REPORT)],EXACT(NewPract[GROUP NAME],$D$2))=0,"No Data",FILTER(NewPract[TAX ID (TAB REPORT)],EXACT(NewPract[GROUP NAME],$D$2))))<>""),"make a selection")
C7C7=IFERROR(UNIQUE(IF(FILTER(NewPract[NPI],EXACT(NewPract[GROUP NAME],$D$2))=0,"no data available",FILTER(NewPract[[NPI]:[PRINT NAME]],EXACT(NewPract[GROUP NAME],$D$2)))),"make selection in field")
F7F7=IFERROR(UNIQUE(IF(FILTER(NewPract[ADDRESS3],EXACT(NewPract[GROUP NAME],$D$2))=0,"No data avialable",FILTER(NewPract[[ADDRESS3]:[FAX (TAB REP MATCH)]],EXACT(NewPract[GROUP NAME],$D$2)))),"make selection in field")
P25P25=FILTER(IFERROR(UNIQUE(IF(FILTER(NewPract[LANG CONSOL],EXACT(NewPract[GROUP NAME],$D$2))=0,"not on file",FILTER(NewPract[LANG CONSOL],EXACT(NewPract[GROUP NAME],$D$2)))),"make Selection in field"),IFERROR(UNIQUE(IF(FILTER(NewPract[LANG CONSOL],EXACT(NewPract[GROUP NAME],$D$2))=0,"not on file",FILTER(NewPract[LANG CONSOL],EXACT(NewPract[GROUP NAME],$D$2)))),"make Selection in field")<>"")
R25R25=IFERROR(UNIQUE(IF(FILTER(NewPract[LOB],EXACT(NewPract[GROUP NAME],$D$2))=0,"No data availabe",FILTER(NewPract[LOB],EXACT(NewPract[GROUP NAME],$D$2)))),"Make selection field")



Combobox properties:
1691080876817.png

1691080913614.png
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
I used an xlookup formula instead...=XLOOKUP('Practice Details V2'!$D$2,Practices6[Pratices],Practices6[Pratices],"Not found",0) ... while this narrows down the search the combobox refuses to recognize the selection. So I would like to ammend my previous cry (there are tears) for help, becuase it appears that it is the combobox that is rejecting the shortened practice names.

1691169147616.png
 
Upvote 0
@Greenbehindthecells
I'm not familiar with searchable combobox using formula, but here's an example with VBA:
VBA Code:
Option Explicit
Dim nFlag As Boolean
Dim vList

'Adjust the code in this part:
'   vList = Sheets("deList").Range("A2", Sheets("deList").Cells(Rows.Count, "A").End(xlUp)).Value
'   Range("A3") = .Value  'send combobox1 value to cell A3

Sub create_List()
Dim d As Object, i As Long

With ComboBox1
    vList = Sheets("deList").Range("A2", Sheets("deList").Cells(Rows.Count, "A").End(xlUp)).Value 'adjust the range reference
    Set d = CreateObject("scripting.dictionary")
    For i = LBound(vList) To UBound(vList)
          d(vList(i, 1)) = 1
    Next
       ComboBox1.List = d.keys
End With
End Sub

Private Sub ComboBox1_GotFocus()
With ComboBox1
    .MatchEntry = fmMatchEntryNone
    .Value = ""
    '.ListRows = 10 'to show how many item
End With
Call create_List
End Sub

Private Sub ComboBox1_DropButtonClick()
    If IsEmpty(vList) Then create_List
End Sub

Private Sub ComboBox1_Change()
Dim d As Object, i As Long
With ComboBox1
    If IsEmpty(vList) Then create_List
    If nFlag = False Then
            If .Value <> "" Then
                Set d = CreateObject("scripting.dictionary")
                For i = LBound(vList) To UBound(vList)
                    If LCase(vList(i, 1)) Like "*" & Replace(LCase(.Value), " ", "*") & "*" Then
                      d(vList(i, 1)) = 1
                    End If
                Next
                   .List = d.keys
                   .DropDown
            End If
    End If
End With

End Sub

Private Sub ComboBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
nFlag = False
With ComboBox1
    Select Case KeyCode
        Case 13 'ENTER
             If .ListIndex > -1 Then
                Range("A3") = .Value  'send combobox1 value to cell A3  'adjust the cell reference
             Else
                MsgBox "Found nothing"
             End If
       
        Case vbKeyDown, vbKeyUp
             nFlag = True 'don't change the list when combobox1 value is changed by DOWN ARROW or UP ARROW key
    End Select
End With
End Sub

Private Sub ComboBox1_LostFocus()
    vList = Empty
    ComboBox1.Clear
End Sub

akuini - searchable combobox sheet.jpg


 
Upvote 0
For my purposes, my combobox needs to search for 'ABC' practice... however, possibly due to the generic names of my other practices (ABC GI, ABC Neph, ABC Card, etc) and the formula I used (sort/filter), the combobox does not allow the selection of 'ABC' practice (my sort\filter formula will return the result of all of ABC practices despite any clicking in the combobox of just 'ABC' practice). The formula works for all other practices with longer more distinct value/names (ABC GI, ABC Neph, ABC Card, etc) with no issues.
Sorry, I might have misunderstood your issue. I thought it was about a searchable combobox. So, forget about my code in post #3.
Did you mean that when you select ABC in the combobox, the value in the linked cell (D2) doesn't get updated?
Try this:
Add this code:

VBA Code:
Private Sub Tempbox4_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
With Tempbox4
    Select Case KeyCode
         Case 13 'ENTER
             If .ListIndex > -1 Then
                Range("D2") = .Value  'send combobox value to cell D2  'adjust the cell reference
             Else
                MsgBox "Found nothing"
             End If

     End Select
End With
End Sub


Basically, if D2 is not updated, you need to hit Enter to send the value from combobox to D2.

If the above code doesn't work then try this one:

VBA Code:
Private Sub Tempbox4_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
With Tempbox4
    Select Case KeyCode
        Case 13 'ENTER
                Range("D2") = .Value  'send combobox1 value to cell D2  'adjust the cell reference
     End Select
End With
End Sub
 
Upvote 0
Solution
Sorry, I might have misunderstood your issue. I thought it was about a searchable combobox. So, forget about my code in post #3.
Did you mean that when you select ABC in the combobox, the value in the linked cell (D2) doesn't get updated?
Try this:
Add this code:

VBA Code:
Private Sub Tempbox4_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
With Tempbox4
    Select Case KeyCode
         Case 13 'ENTER
             If .ListIndex > -1 Then
                Range("D2") = .Value  'send combobox value to cell D2  'adjust the cell reference
             Else
                MsgBox "Found nothing"
             End If

     End Select
End With
End Sub


Basically, if D2 is not updated, you need to hit Enter to send the value from combobox to D2.

If the above code doesn't work then try this one:

VBA Code:
Private Sub Tempbox4_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
With Tempbox4
    Select Case KeyCode
        Case 13 'ENTER
                Range("D2") = .Value  'send combobox1 value to cell D2  'adjust the cell reference
     End Select
End With
End Sub
Sorry, I might have misunderstood your issue. I thought it was about a searchable combobox. So, forget about my code in post #3.
Did you mean that when you select ABC in the combobox, the value in the linked cell (D2) doesn't get updated?
Try this:
Add this code:

VBA Code:
Private Sub Tempbox4_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
With Tempbox4
    Select Case KeyCode
         Case 13 'ENTER
             If .ListIndex > -1 Then
                Range("D2") = .Value  'send combobox value to cell D2  'adjust the cell reference
             Else
                MsgBox "Found nothing"
             End If

     End Select
End With
End Sub


Basically, if D2 is not updated, you need to hit Enter to send the value from combobox to D2.

If the above code doesn't work then try this one:

VBA Code:
Private Sub Tempbox4_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
With Tempbox4
    Select Case KeyCode
        Case 13 'ENTER
                Range("D2") = .Value  'send combobox1 value to cell D2  'adjust the cell reference
     End Select
End With
End Sub
Good morning,

I thank you very much for your replies! Both VBA codes work to push the selection; however, the new codes do not allow the searchable portions of this combobox to work. With the code I had (from a tutorial, I know next to nothing about code, so I apologize if there is a simple solution to have both happening at once) and the settings (also from many tutorials) I was able to have suggestions populate depending on what was typed ( my named range "Dropdown1" pulling from List!E2# in this screenshot) with that code but then it refused to accept the shorter names as a selection. I tried to add my old code to your code... I really don't know how to incorporate that code so that your code works together? Thank you very much for your expertise, I have much grattide for your time and willingness to assist strangers on a forum. If you had the time, may I ask how I could also have the instruction to correctly add vba code for using my 'Dropdown1' named range searchable option with your wonderful code?

Tempbox 4.listfillrange = "Dropdown1"
Me.Tempbox4.Dropdown

1691422165699.png

Tempbox 4.listfillrange = "Dropdown1"
Me.Tempbox4.Dropdown
 
Upvote 0
Good morning,

I thank you very much for your replies! Both VBA codes work to push the selection; however, the new codes do not allow the searchable portions of this combobox to work. With the code I had (from a tutorial, I know next to nothing about code, so I apologize if there is a simple solution to have both happening at once) and the settings (also from many tutorials) I was able to have suggestions populate depending on what was typed ( my named range "Dropdown1" pulling from List!E2# in this screenshot) with that code but then it refused to accept the shorter names as a selection. I tried to add my old code to your code... I really don't know how to incorporate that code so that your code works together? Thank you very much for your expertise, I have much grattide for your time and willingness to assist strangers on a forum. If you had the time, may I ask how I could also have the instruction to correctly add vba code for using my 'Dropdown1' named range searchable option with your wonderful code?

Tempbox 4.listfillrange = "Dropdown1"
Me.Tempbox4.Dropdown

View attachment 96695
Tempbox 4.listfillrange = "Dropdown1"
Me.Tempbox4.Dropdown
Sorry, I might have misunderstood your issue. I thought it was about a searchable combobox. So, forget about my code in post #3.
Did you mean that when you select ABC in the combobox, the value in the linked cell (D2) doesn't get updated?
Try this:
Add this code:

VBA Code:
Private Sub Tempbox4_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
With Tempbox4
    Select Case KeyCode
         Case 13 'ENTER
             If .ListIndex > -1 Then
                Range("D2") = .Value  'send combobox value to cell D2  'adjust the cell reference
             Else
                MsgBox "Found nothing"
             End If

     End Select
End With
End Sub


Basically, if D2 is not updated, you need to hit Enter to send the value from combobox to D2.

If the above code doesn't work then try this one:

VBA Code:
Private Sub Tempbox4_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
With Tempbox4
    Select Case KeyCode
        Case 13 'ENTER
                Range("D2") = .Value  'send combobox1 value to cell D2  'adjust the cell reference
     End Select
End With
End Sub
Sorry, I might have misunderstood your issue. I thought it was about a searchable combobox. So, forget about my code in post #3.
Did you mean that when you select ABC in the combobox, the value in the linked cell (D2) doesn't get updated?
Try this:
Add this code:

VBA Code:
Private Sub Tempbox4_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
With Tempbox4
    Select Case KeyCode
         Case 13 'ENTER
             If .ListIndex > -1 Then
                Range("D2") = .Value  'send combobox value to cell D2  'adjust the cell reference
             Else
                MsgBox "Found nothing"
             End If

     End Select
End With
End Sub


Basically, if D2 is not updated, you need to hit Enter to send the value from combobox to D2.

If the above code doesn't work then try this one:

VBA Code:
Private Sub Tempbox4_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
With Tempbox4
    Select Case KeyCode
        Case 13 'ENTER
                Range("D2") = .Value  'send combobox1 value to cell D2  'adjust the cell reference
     End Select
End With
End Sub
Good morning,

I thank you very much for your replies and your time! Both VBA codes work to push the selection... I have been playing (alright, I have been frankenstiening the old code with your new (wonderful!) code and I think I figured out 1. I have no idea what I am doing, 2. If I dont know what I am doing, I should stop. Spoiler alert, I did not stop. I even rewrote my reply asking for (more) help a million times over and did not send until the very last moment. Then I sent my reply... and just copied and pasted the old code above your code. It created a line in between and it works together. :oops: My brain told me that it could not be as easy as adding them both together (cue the chagrin). I read 'add the code' as add it in between the code I already had.

I am so grateful to you and your help and your code. I appreciate your time and expertise. Thank you so very much!




1691424385291.png
 
Upvote 0
You're welcome, glad to help & thanks for the feedback.:)
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,956
Members
449,096
Latest member
Anshu121

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