excel - macro to delete all the rows containing specific values -


this question has answer here:

i have been working on code delete rows if there specific value in cells column a. works fine , delete rows need, loop keeps going , not understand should stop @ cell "a400". me? thank you!

sub apaga1() dim pulo string sheets("sistema").activate cells.find("lf00").activate activecell.offset(1, 0).select lastcell = range("a400") 'apagar lfs until x = coelhoviado     if left(activecell, 3) = "lf " or left(activecell, 3) = "lfs" or     left(activecell, 4) = "lf00" or left(activecell, 3) = "lft"         activecell.entirerow.delete shift:=xlup         activecell.offset(-1, 0).select         x = x + 1     end if     activecell.offset(1, 0).select loop end sub 

try code:

sub test()  dim lastcell long  dim long  dim ws worksheet  dim rng range   set ws = sheets("sistema")  lastcell = 400   = lastcell 1 step -1   set rng = ws.range("a" & i)   if left(rng.value, 3) = "lf " or left(rng.value, 3) = "lfs" or _     left(rng.value, 4) = "lf00" or left(rng.value, 3) = "lft"         rng.entirerow.delete shift:=xlup   end if  next  end sub 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -