简体   繁体   中英

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

Problem

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

Excel 范围示例

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)"

其中yourrange是命名范围,或用于实际参考

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

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

填写您自己的范围/公式

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM