|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Dim br
Sub tsj()
Application.ScreenUpdating = True
Dim ls As String
ar = Range("b2:d" & [a65536].End(3).Row).Value
br = Sheets("学生数据库").Range("a2:b" & Sheets("学生数据库").[a65536].End(3).Row).Value
For h = 1 To UBound(ar)
ls = ar(h, 1)
ls = c(ls)
If ls = "无" Then
MsgBox "查无此人。"
Else
ar(h, 3) = ls
End If
Next h
Range("b2:d" & [a65536].End(3).Row).Value = ar
Application.ScreenUpdating = True
End Sub
Function c(x As String) As String
For h = 1 To UBound(br)
If x = br(h, 1) Then c = br(h, 2): Exit Function
Next h
c = "无"
End Function
|
|