需要知道为什么发生对象工作表失败错误的方法范围

下面的代码的想法是查找几个表,匹配来自两个不同表的头,并将答案从一个表移到下一个表。

对象工作表失败的方法范围发生在查找function上:

@ colForAnswer = ws.Range(rngColLookup).Find(curCell, LookIn:=xlValues, SearchOrder:=xlByRows, SearchDirection:=xlNext).Column.

我已经搜遍了,找不到任何解决scheme来解决这个问题。 有人可以帮我理解为什么它不工作。

谢谢!

 Sub submitResponses() 'find question name, Grab answer column of table by row, match up to question column, place answer 'view scoring functions if needed 'Redefine a named range of the column headers and search that Dim rngHeaders As Range Dim rngAppQ As Range, rngAppQ2 As Range, rngColLookup As Range Dim rngAppAnswer As Range, rngAppAnswer2 As Range Dim i As Integer Dim ws As Excel.Worksheet Dim answerArea As Integer Dim colForAnswer As Integer Dim curCell As Variant Set ws = ThisWorkbook.Worksheets(appSheet) Set rngAppQ = Worksheets(aTable).Range("tAppInfo" & "[[#All],[Questions]]") Set rngAppAnswer = Worksheets(aTable).Range("tAppInfo" & "[[#All],[Answers]]") Set rngAppQ2 = Worksheets(aTable).Range("tAppInfo2" & "[[#Headers]]") Set rngAppAnswer2 = Worksheets(aTable).Range("tAppInfo2") Set rngColLookup = Worksheets(appSheet).Range(appTable & "[[#Headers]]") Debug.Print rngColLookup.Address answerArea = ws.Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1 For Each curCell In rngAppQ Debug.Print curCell Debug.Print rngColLookup.Address colForAnswer = ws.Range(rngColLookup).Find(curCell, LookIn:=xlValues, SearchOrder:=xlByRows, SearchDirection:=xlNext).Column ws.Cells(answerArea, colForAnswer).Value = curCell Next End Sub