I am producing last report for my venture. I need to ascertain the Sum of aggregate cells in my excel sheet. I have done the accompanying code. Be that as it may, its not computing the qualities.. Here is my code:
我正在为我的冒险制作最后一份报告。我需要确定excel表中聚合单元格的总和。我已经完成了随附的代码。尽管如此,它没有计算质量..这是我的代码:
Worksheet.Cells[20, 16].Formula =
"Sum(" + Worksheet.Cells[6, 16].Value +
":" + Worksheet.Cells[rowIndex, 16].Value + ")";
I need to figure the Cell No 16's Sum esteem and I will show it into Cells[20,16]. Its not working. Anybody help me to settle this?
我需要计算Cell No 16的Sum esteem并将其展示到Cells [20,16]。它不起作用。有人帮我解决这个问题吗?
1 个解决方案
#1
4
Change the two occurrences of .Value
in your code to .Address
.
将代码中出现的两次.Value更改为.Address。
Update ... and add a =
before the Sum
:
更新...并在Sum之前添加一个=:
Worksheet.Cells[20, 16].Formula =
"=Sum(" + Worksheet.Cells[6, 16].Address +
":" + Worksheet.Cells[rowIndex, 16].Address + ")";
#1
4
Change the two occurrences of .Value
in your code to .Address
.
将代码中出现的两次.Value更改为.Address。
Update ... and add a =
before the Sum
:
更新...并在Sum之前添加一个=:
Worksheet.Cells[20, 16].Formula =
"=Sum(" + Worksheet.Cells[6, 16].Address +
":" + Worksheet.Cells[rowIndex, 16].Address + ")";