|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
参与一下。。。- Sub ykcbf() '//2024.1.28
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Set d = CreateObject("Scripting.Dictionary")
- Set d1 = CreateObject("Scripting.Dictionary")
- Set Sh = ThisWorkbook.Sheets("列表")
- With Sheets("长短借款明细表")
- arr = .UsedRange
- For i = 9 To UBound(arr)
- s = arr(i, 1)
- If Not d1.exists(s) Then
- d1(s) = Array(arr(i, 8), arr(i, 14), arr(i, 9), arr(i, 3), arr(i, 4))
- End If
- Next
- End With
- With Sheets("货币资金明细表")
- arr = .UsedRange
- For i = 9 To UBound(arr)
- If arr(i, 13) = "√" Then
- m = m + 1
- If Not d.exists(m) Then
- d(m) = Array(arr(i, 3), arr(i, 1), arr(i, 2), arr(i, 6))
- End If
- End If
- Next
- End With
- With Sh
- arr = .UsedRange
- For i = 3 To UBound(arr)
- s = Val(arr(i, 1))
- If d.exists(s) Then
- arr(i, 3) = d(s)(0)
- For j = 9 To 11
- arr(i, j) = d(s)(j - 8)
- Next
- Else
- arr(i, 3) = ""
- For j = 9 To 11
- arr(i, j) = ""
- Next
- End If
- s = arr(i, 9)
- If d1.exists(s) Then
- arr(i, 6) = d1(s)(0)
- arr(i, 7) = d1(s)(1)
- For j = 12 To 14
- arr(i, j) = d1(s)(j - 10)
- Next
- Else
- arr(i, 6) = ""
- arr(i, 7) = ""
- For j = 12 To 14
- arr(i, j) = ""
- Next
- End If
- Next
- .UsedRange = arr
- End With
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|