|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
参与一下。。。- Sub ykcbf() '//2024.1.15
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Dim arr, brr, d
- Set d = CreateObject("Scripting.Dictionary")
- Set d1 = CreateObject("Scripting.Dictionary")
- p = ThisWorkbook.Path & ""
- f = p & "\数据源.xlsx"
- Set wb = Workbooks.Open(f, 0)
- With wb.Sheets("应收应付试用版")
- arr = .UsedRange
- wb.Close False
- End With
- For i = 3 To UBound(arr)
- If arr(i, 1) <> Empty Then
- If InStr(arr(i, 4), "主营业务增值税") Then
- s = arr(i, 1) & "|" & arr(i, 3)
- d(s) = arr(i, 6)
- d1(s) = arr(i, 7)
- End If
- End If
- Next
- With Sheets("主营业务利润表")
- arr = .[a3:f14]
- For i = 1 To UBound(arr)
- s = arr(i, 1) & "|" & "艺龙"
- arr(i, 5) = d(s)
- arr(i, 6) = arr(i, 2) + arr(i, 3) + arr(i, 4) + arr(i, 5)
- Next
- .[a3:f14] = arr
- arr = .[a20:h31]
- For i = 1 To UBound(arr)
- s = arr(i, 1) & "|" & "大辉"
- arr(i, 5) = d1(s)
- arr(i, 6) = arr(i, 2) + arr(i, 3) + arr(i, 4) + arr(i, 5)
- arr(i, 8) = arr(i, 6) + arr(i, 7)
- Next
- .[a20:h31] = arr
- End With
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|