|
楼主 |
发表于 2019-2-23 19:45
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
函数公式错了,应该为:
- If rs.RecordCount > 0 Then
- i = rs.RecordCount
- With Range("A5").Offset(i, 1)
- .Value = "合计"
- .Offset(0, 5).FormulaR1C1 = "=SUM(R5C:R" & i + 4 & "C7)"
- .Offset(0, 8).FormulaR1C1 = "=SUM(R5C:R" & i + 4 & "C)"
- .Offset(0, 11).FormulaR1C1 = "=SUM(R5C:R" & i + 4 & "C)"
- .Offset(0, 14).FormulaR1C1 = "=SUM(R5C:R" & i + 4 & "C)"
- End With
- With Range("A5").Resize(i + 1, 16)
- .Borders.LineStyle = xlContinuous
- .Font.Size = 10 '字号,根据需要修改
- End With
- End If
复制代码 |
|