Excel VBA:如何将公式插入单元格区域? [英] Excel VBA: How to Insert formula into an area of cells?

查看:271
本文介绍了Excel VBA:如何将公式插入单元格区域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题

我需要在VBA的单元格的二维区域中插入一些公式。例如下面

I need to insert some formulas into a 2 dimensional area of cells with VBA. For example below

当然,我可以使用.Formulas == Sum(....)

Of course I can do this for 1 row with VBA using the .Formulas = "=Sum(....)"

但是如何才能包含一个区域而不是一个范围?这似乎是微不足道的,但我似乎无法弄清楚。我试图避免使用循环填写每一行。

but how can I include an area instead of just a range? This seems so trivial but I can't seem to figure it out. I'm trying to avoid using a loop to fill out every row.

推荐答案

Range("yourrange").Formula = "=Sum(whatever)"

其中您的范围是一个命名范围,或实际参考

where yourrange is a Named Range, or for an actual reference

Range("A1:F8").Formula = "=Sum(whatever)"

这篇关于Excel VBA:如何将公式插入单元格区域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆