اذهب الي المحتوي
أوفيسنا
بحث مخصص من جوجل فى أوفيسنا
Custom Search

الردود الموصى بها

  • أفضل إجابة
قام بنشر

Try this code

Private f As Boolean

Private Sub ComboBox1_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
    PopulateComboBox Me.ComboBox1
End Sub

Private Sub UserForm_Initialize()
    f = False
    Me.ComboBox1.MatchEntry = fmMatchEntryNone
    PopulateComboBox Me.ComboBox1
End Sub

Sub PopulateComboBox(ByVal cmb As MSForms.ComboBox)
    Dim arrIn, arrOut(), i As Long, j As Long
    With Sheets(1)
        arrIn = .Range("B2:B" & .Cells(Rows.Count, "B").End(xlUp).Row).Value
    End With
    ReDim arrOut(1 To UBound(arrIn))
    For i = 1 To UBound(arrIn)
        If arrIn(i, 1) Like "*" & cmb.Text & "*" Then
            j = j + 1
            arrOut(j) = arrIn(i, 1)
        End If
    Next i
    If j = 0 Then cmb.Clear: Exit Sub
    ReDim Preserve arrOut(1 To j)
    With cmb
        .Clear
        .List = arrOut
        If j > 0 And f Then .DropDown Else f = True
    End With
End Sub

 

  • Like 2
  • Thanks 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information