hello, can anybody help me, so i have two comboboxes in one userform and each of comboboxes are dependant. Currently, the first combobox (cmbCode) is typeable, has dropdown list and dependent with the stock box(txtstock) and name box (cmbname), but when i type in the second combobox (cmbName), second combobox is not typeable, has no dropdown list and not dependent with other boxes . I want to make second combobox is also typeable and dependent likewise the first combobox .Can you help me with the code? sampe file is attached below. Thankyou

Reciprocal Comboboxes
- ItsSugarBunny
- Thread is marked as Resolved.
-
-
-
Hello,
Have you had a chance to look into the question you asked 2 days ago ...
-
Thanks a lot for ur help! Can you help me with this one, pleasee?
-
Hello,
Your Excel worksheet is totally empty ...!!!
Make sure to attach a file which illustrates as precisely as possible your actual situation ...:wink:
-
Oops sorry hehe i already reupload the file above. Hope it works Thanks!
-
-
Oops sorry hehe i already reupload the file above. Hope it works Thanks!
You New File ... is ALSO empty ... !!! :wink:
-
already reupload. I promise this one is not empty
sorry and thankyouu!! -
Hello,
Congratulations ...!!!
With your third attempt the File is not empty ...
But you have not tested your UserForm which always remain totally empty ...!!! :wink:
You need to add the following instruction :
in your Private Sub UserForm_Initialize() code ...
Regarding your question about your Dependent Comboboxes:
Do you need to have them mutually dependent ... so each combobox populates the other one ???
Menunggu komentarmu :wink:
HTH
-
What do u mean by my userform remain totally empty?
i currently use this code formy userform:
Code
Display MorePrivate isarrow As Boolean Option Explicit Dim myarray Private Sub cmbCode_Change() Dim i As Long, sh As Worksheet, st As Worksheet, lr As Long With Me.cmbCode If Not isarrow Then .List = myarray 'Range("code").Value If .ListIndex = -1 And Len(.Text) Then For i = .ListCount - 1 To 0 Step -1 If InStr(1, .List(i), .Text, 1) = 0 Then .RemoveItem i Next i .DropDown End If End With Set sh = ThisWorkbook.Sheets("sheet1") Set st = ThisWorkbook.Sheets("sheet2") lr = sh.Range("A" & Rows.Count).End(xlUp).Row For i = 2 To lr If sh.Cells(i, "A").Value = (Me.cmbCode) Or _ sh.Cells(i, "A").Value = Val(Me.cmbCode) Then cmbName.Value = sh.Cells(i, "B").Value End If If cmbCode.Value = Sheets("sheet1").Cells(i, "A").Value Then txtStock.Value = st.Cells(i, "B").Value End If Me.cmbCode.SetFocus Me.cmbCode.DropDown Next End Sub Private Sub cmbCOde_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) isarrow = KeyCode = vbKeyUp Or KeyCode = vbKeyDown If KeyCode = vbKeyReturn Then Me.cmbCode.List = myarray 'Range("code").Value End Sub Private Sub UserForm_Initialize() Dim db, mycollection As Collection, cell As Range With CreateObject("scripting.dictionary") For Each db In Range("code").Value If Not .exists(db) Then .Add db, db End If Next myarray = .keys End With End Sub
Yes i need them both mutually dependant
-
Hello,
Empty ... means :
If you click on the FORM button ... none of your two comboboxes gets populated ... !!!
-
-
Hello again,
Looking at your code ... and your UserForm ...
What you seem to ask for is NOT dependent Comboboxes ...
BUT reciprocal ... since each combobox has to retrieve info and populate the other one ...
-
oh sorry about that im not sure what the terms for it. Do i need to make a new post for this case or just edit the title?
-
No need to worry ... about the proper terms ..
What is the most important ... is to fully understand what you really need ... :wink:
Attached is a new Test file for your review ...
-
OMG THANKYOUU so muchh. It works perfectly! Xx
-
OMG THANKYOUU so muchh. It works perfectly! Xx
Glad to hear the solution is working for you ...!!! :wink:
Thanks again for your Thanks AND also for another Like ... :jumpupdo:
-
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!