|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub 主营业务收支汇总()
-
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Dim sht As Worksheet
- Dim arr1, arr2, arr3, brr
- Dim d1, d2, d3
- Set d1 = CreateObject("scripting.dictionary")
- Set d2 = CreateObject("scripting.dictionary")
- Set d3 = CreateObject("scripting.dictionary")
- strPath = ThisWorkbook.Path & ""
- With Application.FileDialog(1)
- With .Filters
- .Clear
- .Add "Excel Files", "*.xlsx"
- End With
- .AllowMultiSelect = True
- .InitialFileName = strPath
- If .Show Then Set Items = .SelectedItems Else Exit Sub
- End With
- For Each vitem In Items
- With GetObject(vitem)
- If InStr(vitem, "2024年A-B请款单【开采】") Then
- For Each sht In .Sheets
- lie = sht.UsedRange.Find("金额/元").Column
- hang = sht.[a1:a1000].Find("合计").Row
- d1(sht.Name & "月") = Array(Val(Format(sht.Cells(hang, lie), "0.00")), _
- Val(Format(sht.Cells(hang, lie + 1), "0.00")), _
- Val(Format(sht.Cells(hang, lie + 2), "0.00")))
- Next
- End If
- If InStr(vitem, "2024年B-C请款单【开采&机械】") Then
- For Each sht In .Sheets
- lie = sht.UsedRange.Find("金额/元").Column
- hang = sht.[a1:a1000].Find("合计").Row
- d2(sht.Name & "月") = Array(Val(Format(sht.Cells(hang, lie), "0.00")), _
- Val(Format(sht.Cells(hang, lie + 1), "0.00")), _
- Val(Format(sht.Cells(hang, lie + 2), "0.00")))
- Next
- End If
- If InStr(vitem, "2024年B-车队请款【运输】") Then
- For Each sht In .Sheets
- lie = sht.UsedRange.Find("金额").Column
- hang = sht.[a1:a1000].Find("总计").Row
- d3(sht.Name & "月") = sht.Cells(hang, lie)
- Next
- End If
- End With
- Next
- With ThisWorkbook.Sheets("主营业务利润表")
- For x = 3 To 14
- s = .Cells(x, 1).Value
- If d1.exists(s) Then
- .Cells(x, 2) = d1(s)(0)
- .Cells(x, 3) = d1(s)(1)
- .Cells(x, 4) = d1(s)(2)
- End If
- Next
- .[b15].Resize(1, 3).FormulaR1C1 = "=SUM(R3C:R[-1]C)"
-
- For x = 20 To 31
- s = .Cells(x, 1).Value
- If d2.exists(s) Then
- .Cells(x, 2) = d2(s)(0)
- .Cells(x, 3) = d2(s)(1)
- .Cells(x, 4) = d2(s)(2)
- End If
-
- If d3.exists(s) Then
- .Cells(x, 7) = d3(s)
- End If
- Next
- .[b32].Resize(1, 7).FormulaR1C1 = "=SUM(R20C:R[-1]C)"
- End With
- MsgBox "ok!"
- Application.DisplayAlerts = True
- Application.ScreenUpdating = True
- End Sub
复制代码 为什么之前的还不显示呢?审核时间也太长了吧
|
|