|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub a()
Dim arr, hs, k
hs = Sheet2.Range("B65536").End(xlUp).Row
arr = Sheet2.Range("A3:E" & hs)
Sheet3.Range("B5") = ""
Sheet3.Range("D5") = ""
Sheet3.Range("D6") = ""
Sheet3.Range("B7") = ""
Sheet3.Range("F5") = ""
For k = 1 To UBound(arr)
If arr(k, 2) = Sheet3.Range("B6") Then
Sheet3.Range("B5") = arr(k, 5)
Sheet3.Range("D5") = arr(k, 3)
Sheet3.Range("D6") = arr(k, 1)
Sheet3.Range("B7") = arr(k, 4)
Sheet3.Range("F5") = 1
Exit For
End If
Next k
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Target.Address = "$B$6" Then
Call a
End If
End Sub
根据”阅办单“中B6文件编号在"来文登记"中查找文件信息并填到“阅办单”,改变B6,查看对应信息。win10+excel2019 运行正常。 |
|