excel vba - Get reference to next visible cell in autofiltered table -
i have userform sits on top of spreadsheet , displays information row containing selected cell. buttons on form allow user move up/down spreadsheet row row. example, when "next record" button clicked, code executed like:
cells(activecell.row + 1, activecell.column).select loadvalues
i work if user filters data , loads form. however, using above code, wants loop through cells, not ones still visible after filtering. i've seen solutions looping through visible cells, e.g.,
for each viscell in rng.specialcells(xlcelltypevisible) ... next viscell
so there seems there should better, more direct way looping through rows until next 1 .hidden = false
can't seem figure out how reference "the next visible cell" in order select it.
any pointers appreciated. thanks.
here 1 method using simple loop until next row down visible.
dim rng range set rng = activecell dim n long: n = 1 until rng.offset(n, 1).rows.hidden = false n = n + 1 loop rng.offset(n, 1).select loadvalues
Comments
Post a Comment