发布网友 发布时间:2023-08-09 07:03
共1个回答
热心网友 时间:2023-10-02 17:39
vba公式中,使用变动值方法如下:
Sheets("总表").Cells(6 + x, 6).Value = Application.Sum(Range("j" & x & ":v" x))具体可以根据你需要的修改。
插入的公式,在vba里面其实是字符串,所以可以用字符连接符 & 连接变量,如下示例:
Option Explicit
Sub test() Dim i As Integer For i = 1 To 5 ActiveSheet.Range("a" & i).Formula = "=sum(" & i _ & "," & i + 1 & "," & i + 2 & "," & i + 3 & ")" Next iEnd Sub