Process a combobox called from another userform

核能气质少年 提交于 2020-01-06 08:07:58

问题


I have a userform that contains a combobox where I can search through.

If I recall this userform directly, the combobox works fine.

If I instead start from another userform and press a button to open the userform with my combobox, the search won't work.

I tried with "_Change".

This is the applicable part of the first userform:

If InStr(I1.Text, " ") > 0 Then
    New_Pat.First.Text = Left(I1.Text, Len(I1.Text) - 1 - (Len(I1.Text) - InStr(I1.Text, " ")))
    New_Pat.Second.Text = Right(I1.Text, Len(I1.Text) - Len(Left(I1.Text, Len(I1.Text) - (Len(I1.Text) - InStr(I1.Text, " ")))))
    New_Pat.Combobox10.SetFocus
Else
    New_Pat.First.Text = I1.Text
    New_Pat.Combobox10.SetFocus
End If
New_Pat.Show

And this is the part of New_Pat

Private Sub ComboBox10_Change() 'Keydown(ByVal keycode As MSforms.ReturnInteger, ByVal shift As Integer)        'Click()      'AfterUpdate()        'Change()
    Sheets("ListOfName").Select
    ComboBox1.Value = Cells(ComboBox10.ListIndex + 2, 91)         
End Sub

来源:https://stackoverflow.com/questions/59582575/process-a-combobox-called-from-another-userform

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!