简体   繁体   English

获取Excel插件以修改数组公式参数; 或执行“ ctrl-shift-enter”

[英]Getting Excel add ins to modify array formula parameters; or perform 'ctrl-shift-enter'

I am trying to make a C# Excel add in change the parameters of an array formula in-place; 我正在尝试使C#Excel添加就地更改数组公式的参数; ie do the same as a user modifying an array formula and hitting ctrl-shift-enter. 即与用户修改数组公式并按ctrl-shift-enter一样。

Setting the activeCell.FormulaArray property does not achieve this; 设置activeCell.FormulaArray属性无法实现此目的; it throws a 'You cannot change part of an array' error. 它会引发“您无法更改数组的一部分”错误。

Does anyone know how I can achieve this? 有谁知道我怎么能做到这一点?

A solution that also works in VBA would be brilliant. 在VBA中也可以使用的解决方案非常出色。

I've tried creating some logic that 'walks' to the perimeter of the array formula and deletes it first, but it doesn't account for adjacent array formulas and I believe this is unnecessarily drastic. 我尝试创建一些逻辑,以“遍历”数组公式的外围并首先将其删除,但这并不能说明相邻的数组公式,我认为这是不必要的。

Sounds like you are looking for the CurrentArray property 听起来您正在寻找CurrentArray属性

In VBA this will enter a multicell array formula into all the cells of the array formula one cell of which is Z99 在VBA中,这会将一个多单元格数组公式输入到该数组公式的所有单元格中,其中一个单元格为Z99

Range("Z99").CurrentArray.FormulaArray=" ... "

http://tukhi.com/tukhi_fun.html上的Adjust.zip会执行此操作。

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

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