VBA 在查找函数运行时错误 91 [英] VBA in find function runtime error 91
本文介绍了VBA 在查找函数运行时错误 91的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的问题是关于 VBA for excel 中的运行时错误 91.我做了一些搜索无济于事.我的代码如下.我已经注意到导致错误的部分.为什么会发生这种情况,我该如何解决它并继续前进?
My question is concerning the runtime error 91 in VBA for excel. I've done some searching to no avail. My code is below. I have noted the section causing the error. Why is this happening, and how can i fix it and move on?
Sub RemoveFooterRows(theFile)
Dim found As Range
Dim aggregateRow
''Error is from section below
found = isItRow = Workbooks(theFile).Worksheets(1).Columns(1).Find _
("Summary", Range("A1"), xlValues, xlPart, xlByRows, xlNext, False, , False)
''Error is from section above
MsgBox ("val is " & found.Row)
End Sub
推荐答案
Sub RemoveFooterRows(theFile)
Dim found As Range
Set found = Workbooks(theFile).Worksheets(1).Columns(1).Find _
("Summary", Range("A1"), xlValues, xlPart, xlByRows, xlNext, False, , False)
MsgBox ("val is " & found.Row)
End Sub
您需要Set"关键字来分配值.
You need the "Set" keyword to assign the value.
也不确定你想让 " =isItRow =" 做什么,但你应该在两个语句中做,而不是试图像那样堆叠它们.
Also not sure what you want " =isItRow =" to do but you should do it in two statements instead of trying to stack them like that.
另外,aggregateRow 没有被使用,也没有被分配一个类型.
Also aggregateRow isn't used and isn't assigned a type.
这篇关于VBA 在查找函数运行时错误 91的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文