excel - vba Row numbers for filtered rows -
i have code capture row number in filtered table, things , go next visible row. works great first row.
sub test() dim rn long dim cell range dim rng range set rng = sheets("fabricatedparts").range("a:a").specialcells(xlcelltypevisible) rn = sheets("fabricatedparts").usedrange.offset(1, 0).specialcells(xlcelltypevisible).row each cell in rng activesheet .range("b14").value = [parts].cells(rn, [parts[part.]].column) end 'rn = next visible row #???.row next cell end sub
when change offset(1, 0) offset(2, 0) still returns row number first visible row(in case 10). looking vba statement return row number next visible row , pass number rn variable. filtered range testing next row number 11, next 165, next 166 etc. thank time.
use row number of cell loop.
sub test() dim rn long dim cell range dim rng range set rng = sheets("fabricatedparts").range("a:a").specialcells(xlcelltypevisible) each cell in rng rn = cell.row activesheet .range("b14").value = [parts].cells(rn, [parts[part.]].column) end next cell end sub
Comments
Post a Comment