|
合计金额大写,没做,这个要不用公式,要不单独写一段代码- Sub test()
- Set d = CreateObject("scripting.dictionary")
- arr = Sheet1.UsedRange
- For i& = 2 To UBound(arr)
- d(arr(i, 2) & " " & arr(i, 1)) = d(arr(i, 2) & " " & arr(i, 1)) & " " & i
- Next
- brr = d.items
- Sheet2.[a4:f13].ClearContents
- Set Rng = Sheet2.[a1:f17]
- Sheet2.[a18:f340].Clear
- Rng.Copy Sheet2.[a18:f340]
- brr = Sheet2.[a1:f340]
- For Each x In d.keys
- br = Split(d(x))
- For i = 1 To Int((UBound(br) - 1) / 10) + 1
- n = n + 1
- brr(n * 17 - 15, 2) = Split(x)(0)
- brr(n * 17 - 15, 5) = Split(x)(1)
- brr(n * 17 - 3, 3) = "=sum(indirect(""r[-1]c:r[-10]c"",))"
- brr(n * 17 - 3, 5) = "=sum(indirect(""r[-1]c:r[-10]c"",))"
- For k% = 0 To 9
- If i + k <= UBound(br) Then
- For j% = 3 To 8
- brr(n * 17 + k - 13, j - 2) = arr(br(i + k), j)
- Next j
- End If
- Next k
- Next i
- Next
- Sheet2.[a1].Resize(n * 17, 6) = brr
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|