Tuesday, 15 February 2011

vba - excel delete rows in some cases -



vba - excel delete rows in some cases -

how can delete whole row of excel sheet, if in column g has number starts 210.

i don't want delete row if cell has 210 somewhere inside, when start it.

use code:

sub removerows() dim long = 1 while <= thisworkbook.activesheet.range("g1").currentregion.rows.count if left(thisworkbook.activesheet.range("g" & i).formula, 3) = "210" thisworkbook.activesheet.cells(i, 1).entirerow.delete else = + 1 end if loop end sub

sample file: https://www.dropbox.com/s/yp2cwphhhdn3l98/remowerows210.xlsm

to see , run, press alt-f11, open module1 , press f5. luck!

excel vba excel-vba delete-row

No comments:

Post a Comment