简体   繁体   English

Excel VBA 动态公式

[英]Excel VBA dynamic Formula

I need to convert the following Excel VBA formula into a Dynamic reference.我需要将以下 Excel VBA 公式转换为动态引用。 To be clear not the location of the formula, I mean the cell and sheet references with in the formula itself.要清楚不是公式的位置,我的意思是公式本身中的单元格和工作表引用。

ActiveCell.Offset(1, 1).Formula = "=INDEX(DigiFull!$A$1:$DB$855,MATCH($E2,DigiFull!$A$1:$A$855,0),MATCH(M2,DigiFull!$A$1:$DB$1,1))"

You can simply set the formula to the whole range at once:您可以简单地一次将公式设置为整个范围:

ActiveSheet.Range("ZZ2:AAA10").Formula = "=INDEX(DigiFull!$A$1:$DB$855,MATCH($E2,DigiFull!$A$1:$A$855,0),MATCH(M2,DigiFull!$A$1:$DB$1,1))"

And any row/column that is not absolute will change on its own relative to the upper left cell in the target range.并且任何不是绝对的行/列都会相对于目标范围中的左上角单元格自行更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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