excel - Need to know why Method Range of Object Worksheet Failed Error is occuring -
the idea of code below few tables, match headers 2 different tables , move answers 1 table next.
the method range of object worksheet failed happening on find function:
@ colforanswer = ws.range(rngcollookup).find(curcell, lookin:=xlvalues, searchorder:=xlbyrows, searchdirection:=xlnext).column.
i have searched on , cannot find solutions solve problem. can please me understand why not working.
thank you!
sub submitresponses() 'find question name, grab answer column of table row, match question column, place answer 'view scoring functions if needed 'redefine named range of column headers , search dim rngheaders range dim rngappq range, rngappq2 range, rngcollookup range dim rngappanswer range, rngappanswer2 range dim integer dim ws excel.worksheet dim answerarea integer dim colforanswer integer dim curcell 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 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
Comments
Post a Comment