excel - Remove all rows that don't have #3 as the beginning in primary key -
so basically, need remove records don't have 3 2nd digit in primary key field example can either this
#39001
or without #3
what want cells have non #3 start, rows deleted came following code, removes non #3, not all. have on 13000 rows scan
sub keep3() ' ' removenum macro dim integer = 2 14000 if instr(cells(i, 2), "3") = 2 else rows(i).entirerow.delete end if next end sub
if can point me in right direction, i'd grateful!
thanks!
when delete row rows below move up, increment "i" skips newly moved row. try following instead...
sub keep3() ' ' removenum macro dim integer = 2 while < 14000 if instr(cells(i, 2), "3") = 2 ' nothing = + 1 else rows(i).entirerow.delete ' note - not incrementing here end if wend end sub
Comments
Post a Comment