|
工作表中在第4行开始才有数据,底端的数据在多少行是不确定的。录制了宏才发现,它只能算200行的数据,它跟手动计算的结果是不相符,另外还要请教一下,我想把计算出来的数据填到下面总结里面,如图1所示,文本“符合入临床路径人数共D205人”,我应用函数通配符提示文本太长,能不能一起写入vba中。
我的vba代码如下:
Sub 路径统计()
'
' 路径统计 Macro
' 路径统计,时间: 2019-6-17
'
' 快捷键: Ctrl+q
'
ActiveCell.Select
ActiveCell.FormulaR1C1 = "=SUM(R[-201]C:R[-1]C)"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-201]C:R[-1]C)"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-201]C:R[-1]C)"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-201]C:R[-1]C)"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=RC[-3]/RC[-4]"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=RC[-3]/RC[-4]"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=RC[-3]/RC[-5]"
ActiveCell.Offset(0, -2).Range("A1:C1").Select
Selection.NumberFormatLocal = "0.00%"
ActiveCell.Offset(0, 3).Range("A1").Select
ActiveCell.FormulaR1C1 = _
"=(SUMPRODUCT(R[-202]C[-5]:R[-1]C[-5],R[-202]C:R[-1]C))/RC[-5]"
ActiveCell.Offset(0, 2).Range("A1").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-201]C:R[-1]C)"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-201]C:R[-1]C)"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-201]C:R[-1]C)"
ActiveCell.Offset(0, 2).Range("A1").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-201]C:R[-1]C)"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=RC[-1]/RC[-12]"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-201]C:R[-1]C)"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = _
"=(SUMPRODUCT(R[-201]C[-1]:R[-1]C[-1],R[-201]C:R[-1]C))/280"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-201]C:R[-1]C)"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-201]C:R[-1]C)"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=RC[-1]/RC[-4]"
ActiveCell.Offset(0, 1).Range("A1").Select
A |
|