在Excel文档中按名称提取单元格值

时间:2022-09-14 23:49:12

I want to Extract some value from an Excel spreadsheet by using cell name instead of using cell reference (row,column).

我想通过使用单元格名称而不是使用单元格引用(行,列)从Excel电子表格中提取一些值。

The reason of that is because user want to modify their Excel (add or remove lines/column) and don't want to take care for the cell reference of my rails process. The alternative of that is to use cell naming function into Excel spreadsheet I think.

原因是因为用户想要修改他们的Excel(添加或删除行/列)并且不想照顾我的rails进程的单元格引用。另一种方法是将单元命名功能用于Excel电子表格中。

Is there a way to do that?

有没有办法做到这一点?

if yes, what GEM parser can be the best (spreadsheet, roo, etc)?

如果是的话,什么GEM解析器可能是最好的(电子表格,roo等)?

Thanks.

谢谢。

1 个解决方案

#1


0  

I made a named range comprised of a single cell.

我制作了一个由单个细胞组成的命名范围。

The logic in my function doesn't change now, to suit your requirement:

我的功能中的逻辑现在没有改变,以满足您的要求:

Function CallFunctionFromExternalExtract() As Variant

    CallFunctionFromExternalExtract = Application.Names("MyRangeName").RefersToRange.Formula

End Function

You should be able to call this from your extract program, if it can enable macros.

如果它可以启用宏,您应该能够从提取程序中调用它。

#1


0  

I made a named range comprised of a single cell.

我制作了一个由单个细胞组成的命名范围。

The logic in my function doesn't change now, to suit your requirement:

我的功能中的逻辑现在没有改变,以满足您的要求:

Function CallFunctionFromExternalExtract() As Variant

    CallFunctionFromExternalExtract = Application.Names("MyRangeName").RefersToRange.Formula

End Function

You should be able to call this from your extract program, if it can enable macros.

如果它可以启用宏,您应该能够从提取程序中调用它。