من نام کارمندان را در ستون "A" تحت عنوان cboName و شماره کارمندی انها را در ستون "B" در sheet1 دارم. حالا میخوام وقتی در فرم اسم کارمندی رو از cboName انتخاب کردم شماره کارمندی اون شخص در txtEmployeeNumber نمایش داده شود.
اگر کد زیر رو در UserForm Module قرار بدم کارنمیکنه اما دکمه های کنترل مثل OK,Clear و Close کارمی کنند.
Private Sub cboName_Change()
Dim EName As String
Dim Row As Integer
EName = cboName.Value
With Application.WorksheetFunction
Row = .Match(EName, Sheets("sheet1").Range("A2:A100"), 0)
txtEmployeeNumber.Text = .Index(Sheets("sheet1").Range("B2:B100"), Row)
txtShift.Text = .Index(Sheets("sheet1").Range("C2:C100"), Row)
End With
End Sub
Unable to get the match property of worksheet function class
Row = .Match(EName, Sheets("sheet1").Range("A2:A100"), 0)



کامنت