|
楼主 |
发表于 2013-7-17 22:28
|
显示全部楼层
蓝桥玄霜 发表于 2013-7-17 20:51
这是我自己修改后的,但为什么我选中E2或E3时, 按Delete键后,文件会自动关闭?
VBA多条件查询修改.rar
(15.9 KB, 下载次数: 398)
[code=vb]
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Arr, i&, Brr, d
Set d = CreateObject("Scripting.Dictionary")
Sheet2.Activate
Arr = Sheet1.[a1].CurrentRegion
For i = 2 To UBound(Arr)
x = Arr(i, 1) & "|" & Arr(i, 2) & "|" & Arr(i, 3) & "|" & Arr(i, 4)
d(x) = Arr(i, 5)
Next
Brr = Range("A" & ActiveCell.Row & ":D" & ActiveCell.Row)
x = Brr(1, 1) & "|" & Brr(1, 2) & "|" & Brr(1, 3) & "|" & Brr(1, 4)
If d.exists(x) Then Cells(ActiveCell.Row, 5) = d(x)
End Sub
[/code]
|
|