|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Private Sub ComboBox1_Change()
If Len(ComboBox1.Text) > 0 Then
str1 = Left(ComboBox1.Text, 6)
Set rng = Sheets("员工基本资料").Columns(1).Find(str1, lookat:=xlWhole)
If rng Is Nothing Then
MsgBox "对应的工号不存在"
Exit Sub
End If
arr = Sheets("员工基本资料").UsedRange
Application.ScreenUpdating = False
rx = rng.Row
For Each c In Array(2, 5, 7)
For R = 3 To 29
If Len(Cells(R, c)) > 0 Then
Cells(R, c + 1) = ""
For j = 1 To UBound(arr, 2)
If arr(1, j) = Cells(R, c) Then
Cells(R, c + 1) = arr(rx, j)
Exit For
End If
Next j
End If
Next R
Next c
Application.ScreenUpdating = True
End If
End Sub |
|