对象_工作表的方法范围失败

我有一个公式,我试图通过Print.Debug来绘制 – 我可以看到,我的公式是有道理的,但范围不计算,但抛出错误标题。

在Print.Debug中,我可以看到str是=

=OFFSET(Menu!A:A,(3+COUNTIF(Menu!F:F,"Drikke")+COUNTIF(Menu!F:F,"Ernæring")-1),0,COUNTIF(Menu!F:F,"Mad"),1) 

我的代码行如下所示:

 With cboTemp 'show the combobox with the list .Visible = True .Left = Target.Left .Top = Target.Top .Width = Target.Width + 5 .Height = Target.Height + 5 Problem is, that I'm taking the formula from a datavalidated, and it's not parsing correctly. I'm using: .ListFillRange = Target.Validation.Formula1 , but the range of the datavalidation is not shown, and I know from the original cell, that the formula is valid <---- Line that throws error .LinkedCell = Target.Address End With 

为什么错误被抛出?

编辑

我已经尝试从datavalidated单元格中使用公式(str),使用: .ListFillRange = Target.Validation.Formula1 ,但数据validation的范围不显示,并从原始单元格中知道该公式是有效的

我现在没有得到一个错误,但也没有显示范围 – 我怀疑这与“IgnoreBlankCells”属性有关?

而不是给它一个Range对象,只要给它你的str对象。

尝试

 .ListFillRange = str 

关于dynamic设置这个主题, 这是一个很好的问题