开发者

Excel VBA: How to Insert formula into an area of cells?

开发者 https://www.devze.com 2023-03-30 11:24 出处:网络
Problem I need to insert some formulas into a 2 dimensional area of cells with VBA. For example below Of course I can do this for 1 row with VBA using the .Formulas = \"=Sum(....)\"

Problem

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

Excel VBA: How to Insert formula into an area of cells?

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开发者_JAVA百科 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)"


range("A1:G10").formula = "=Sum(H1:H10)"

Fill in your own range/formula

0

精彩评论

暂无评论...
验证码 换一张
取 消