|
参与一下。。。
- Sub ykcbf() '//2024.5.9
- Dim arr, d
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- With Sheets("数据")
- r = .Cells(.Rows.Count, "a").End(xlUp).Row
- arr = .[a1].Resize(r, 4)
- End With
- For i = 2 To UBound(arr)
- s = arr(i, 1)
- d(s) = i
- Next
- For j = 2 To UBound(arr, 2)
- s = arr(1, j)
- d(s) = j
- Next
- With Sheets("查找")
- r = .Cells(.Rows.Count, "a").End(xlUp).Row
- brr = .[a1].Resize(r, 4)
- For i = 2 To UBound(brr)
- s = brr(i, 1)
- If d.Exists(s) Then
- For j = 2 To UBound(brr, 2)
- ss = brr(1, j)
- brr(i, j) = arr(d(s), d(ss))
- Next
- End If
- Next
- .[a1].Resize(r, 4) = brr
- End With
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|