excel - No Object Variable Set when using multiple range.find and findnext() -
i trying search persons' name within range.find keep getting run-time error 91 - object variable or block variable not set. happens "rngfound" within "getpaid". sub emailclick() dim lastseasonrow double lastseasonrow = worksheets("season 2014-2015").range("a" & worksheets("season 2014-2015").rows.count).end(xlup).row dim lastseasonemailrow1 double lastseasonemailrow1 = worksheets("email").range("a" & worksheets("email").rows.count).end(xlup).row dim rng range dim rngfound range dim getpaid range dim erroremail string dim colmycol new collection 'our collection j = 2 lastseasonrow set rng = worksheets("email").range("a2:a" & lastseasonemailrow1) set rngfound = rng.find(worksheets("season 2014-2015").cells(j, 1).value) if not rngfound nothing ' if found if doesitemexist(colmycol, rngfound.offset(0, 1).value) = false ...