Excel VBA:如何将公式插入到单元格区域?
问题描述:
我需要插入一些公式到VBA单元格的2维区域。例如低于
我当然可以为1行做到这一点与使用.Formulas =“= SUM(....)”
VBA但如何可以包括区域代替只是一个范围?这似乎很琐碎,但我似乎无法弄清楚。我试图避免使用循环来填充每一行。
答
Range("yourrange").Formula = "=Sum(whatever)"
其中yourrange
是一个命名范围,或为实际参考
Range("A1:F8").Formula = "=Sum(whatever)"
答
range("A1:G10").formula = "=Sum(H1:H10)"
填你自己的范围/公式
定义你所说的 “范围” 的意思是什么,按“区域”。我怀疑你只是用两个不同的名字来混淆你自己,这个名字真的是一回事...... –