|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
代码已经测试通过。
- Sub ykcbf() '//2024.2.4
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Set Fso = CreateObject("Scripting.FileSystemObject")
- p = ThisWorkbook.Path & ""
- p1 = p & "下拨明细文件夹"
- If Not Fso.FolderExists(p1) Then Fso.CreateFolder p1
- fn = "下拨明细" & Format(Date, "yyyy-m-d")
- Sheets("下拨明细").Cells.Copy Sheets("配钞明细").[a1]
- With Sheets("配钞明细")
- arr = .UsedRange
- .DrawingObjects.Delete
- ReDim brr(1 To UBound(arr), 1 To UBound(arr, 2))
- For i = 3 To UBound(arr)
- If arr(i, 1) <> Empty Then
- If Val(arr(i, 12)) Then
- m = m + 1
- brr(m, 1) = m
- For j = 2 To UBound(arr, 2)
- brr(m, j) = arr(i, j)
- Next
- End If
- End If
- Next
- .[a3].Resize(m, 12) = brr
- r = m + 3
- .UsedRange.Offset(r).Clear
- .Cells(r, 1).Resize(1, 2) = "": .Cells(r, 3) = "合计"
- .Cells(r, 4).Resize(1, 9).FormulaR1C1 = "=SUM(R3C:R" & "[-1]C)"
- .[a3].Resize(m + 1, 12).Borders.LineStyle = 1
- End With
- Sheets("下拨明细").Copy
- Set wb = ActiveWorkbook
- wb.Sheets(1).DrawingObjects.Delete
- wb.SaveAs p1 & fn
- wb.Close 1
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
3
查看全部评分
-
|