excel - Find the next visible row -
i trying write function return next visible row in autofiltered list.
in sheet autofiltered range code below returns #value error:
function findnextvisible(s range) range dim l range dim r range dim counter integer counter = 1 set l = range(s, s.end(xldown)).cells.specialcells(xlcelltypevisible) each r in l counter = counter + 1 if counter = 2 findnextvisible = r next end function
i suspect beginners error...
update 1: ok great advice. can't use specialcells. unfortunately vba not strong in me , i'm having trouble sub version.
perhaps there way. want compare text between non-contiguous (due filtering) rows, don't know how provide formula reference next visible row.
tthe following should accomplish looking for.
public function nextvisiblecell(range range) range application.volatile dim long set range = range.cells(range.rows.count, range.columns.count) = 1 rows.count - range.row if not range.offset(i).entirerow.hidden set nextvisiblecell = range.offset(i) exit function end if next end function
Comments
Post a Comment