简体   繁体   English

在VLOOKUP中具有名称范围的引用单元格

[英]Reference cell with a name range in VLOOKUP

I'm trying to do a VLOOKUP, but for the table array, I'm trying to reference a single cell that holds the name range value. 我正在尝试执行VLOOKUP,但是对于表数组,我正在尝试引用包含名称范围值的单个单元格。 Is there a way to make the VLOOKUP recognise the name range without using INDIRECT? 有没有一种方法可以使VLOOKUP在不使用INDIRECT的情况下识别名称范围?

The addon I'm using to convert the Excel doc to a HTML interface, doesn't allow for INDIRECT unfortunately. 不幸的是,我用于将Excel文档转换为HTML界面的插件不允许使用INDIRECT。 VBA won't work as well. VBA不能正常工作。

Any help would be greatly appreciated. 任何帮助将不胜感激。

If the name of the range (eg MyRange ) is in A1 then something like this, 如果范围的名称(例如MyRange )在A1中,则类似这样,

with activesheet
    application.vlookup(123, range(.Range("A1").value), 2, false)
    application.vlookup(123, range(.Cells(1, 1).value), 2, false)
end with

Note that it is important that the parent worksheet of the cell containing the name of the named range be specified. 请注意,指定包含命名范围名称的单元格的父级工作表非常重要。 Not so much for the Range object actually getting the range with the string returned. 对于Range对象,实际上返回返回的字符串的范围不是很多。

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

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