|
登记日记账代码- Dim d
- Sub 汇总费用()
- Dim st As Worksheet
- Dim arr
- Dim i%, j%, m%
- Dim iRow%
- Dim brr(1 To 500, 1 To 7)
- Set d = CreateObject("scripting.dictionary")
-
- For Each st In Worksheets
- If Not st.Name Like "*汇总" And Not st.Name Like "*日记账" Then
- arr = st.Range("a1").CurrentRegion
- If IsEmpty(arr) Then GoTo ghb
- For i = 4 To UBound(arr)
- If arr(i, 1) <> "" And arr(i, 1) <> "本 单 汇 总" Then
- d(arr(i, 3)) = arr(i, 1) & vbTab & arr(i, 2) & vbTab & arr(i, 3) & vbTab & arr(i, 4) & vbTab & arr(i, 5) & vbTab & arr(i, 6) & vbTab & arr(i, 7)
- m = m + 1
- For j = 1 To 7
- brr(m, j) = arr(i, j)
- Next
- End If
- Next i
- End If
- Next
- ghb:
- iRow = Sheets("201609现金日记账").Cells(Rows.Count, "a").End(xlUp).Row + 1
- Sheets("201609现金日记账").Range("a" & iRow).Resize(m, 7) = brr
- For i = 4 To Sheets("201609现金日记账").Cells(Rows.Count, "a").End(xlUp).Row - 1
- If i = 4 Then Cells(4, 8).Formula = "=rc[-2]-rc[-1]"
- Cells(i + 1, 8).Formula = "=r[-1]c-rc[-1]"
- Next
- End Sub
复制代码 |
|