作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
下面的宏创建 i
新工作表的数量并将 E13 中的总计复制到单元格 F6 中的“总计”工作表中。我们还需要从“资源计算器”单元格 E14 中获取总计并将其复制到“总计”工作表单元格 F7。寻找一个好的方法来做到这一点的建议。提前致谢!
Sub Mac()
Sheets("total").Visible = True
Dim i As Integer, SumFormula As String
For i = 1 To Sheet1.Range("A15").Value
Sheets("Resource Estimator").Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = "Batch " & i
If i = 1 Then
SumFormula = "=SUM('" & ActiveSheet.Name & "'!E13" 'begin sum formula
Else
SumFormula = SumFormula & ",'" & ActiveSheet.Name & "'!E13" 'iterate sum formula
End If
Next i
SumFormula = SumFormula & ")" 'end sum formula
ThisWorkbook.Sheets("Total").Range("F6").Formula = SumFormula 'write sum formula to cell F6
End Sub
最佳答案
我将利用 3D 公式如下:
For i = 1 To Sheet1.Range("A15").Value
Sheets("Resource Estimator").Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = "Batch " & i
Next i
With Sheets("total")
.Visible = True
.Range("F6").Formula = "=sum('Batch 1:Batch " & i - 1 & "'!E13)"
.Range("F7") = Sheets("Resource Estimator").Range("E14")
End With
关于vba - SumForumla : Two sumformula functions copied to two different cells in a "total" sheet,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43207294/
下面的宏创建 i新工作表的数量并将 E13 中的总计复制到单元格 F6 中的“总计”工作表中。我们还需要从“资源计算器”单元格 E14 中获取总计并将其复制到“总计”工作表单元格 F7。寻找一个好的方
我是一名优秀的程序员,十分优秀!