【发布时间】:2021-02-23 04:15:38
【问题描述】:
我正在尝试一种简单的方法来为特定工作分配员工。
拥有Table1(员工技能),并拥有Table2(职位要求)。我希望能够检查员工是否具备足够的技能来胜任某项工作。
这样,我有两个列表框,Listbox1 作为 Table1,Listbox2 作为 Table2。我有以下代码来查找 Listbox1 和 Listbox2 中特定行的索引
Dim i As Integer
Dim j As Integer
With ListBox1
.MultiSelect = fmMultiSelectSingle
.ListIndex = -1
.MultiSelect = fmMultiSelectMulti
For i = 0 To .ListCount - 1
For j = 0 To .columnCount - 1
If ComboBox2.Value = .Column(j, i) Then
.ListIndex = i
.Selected(i) = True
End If
Next j
Next i
End With
在 Listbox1 和 2 中识别出员工的行和工作的行后,我想检查它们之间的匹配值,并在 Listbox3 上显示匹配的值。我目前有以下代码,但仅适用于具有一列的列表框:
Dim i As Long, j As Long
Dim fMatch As Long
For i = 1 To ListBox1.ListCount
fMatch = False
For j = 1 To ListBox2.ListCount
If ListBox1.List(i - 1) = ListBox2.List(j - 1) Then
fMatch = True
Exit For
End If
Next j
If fMatch Then
ListBox3.AddItem ListBox1.List(i - 1)
End If
Next i
我也在尝试获取最适合 listbox3 中角色的员工列表。
【问题讨论】: