excel - Duplicating row when pasting -


i have vba code supposed copy row on sheet called "projects overview" "complete - design" in "n" column , paste sheet. working correctly awhile, pastes row more once. found number of duplicates pasted matches number of rows being used in "projects overview" sheet. think code looping , running through each row.

here have far:

sub completejob()  'looks through status column (n) of projects overview table , moves them completed table, deletes row projects list dim firstrow long dim lastrow long dim lrowprojectsoverview long  sheets("projects overview")     .select      firstrow = .usedrange.cells(1).row     lastrow = .usedrange.rows(.usedrange.rows.count).row     lrowprojectsoverview = lastrow firstrow step -1         .cells(lrowprojectsoverview, "n")             if not iserror(.value)                 if ((.value = "complete - design") or (.value = "p4p") or (.value = "ready setup")) .entirerow.copy sheet3.range("a200")                      if sheet9.range("b2").value = ""                         sheet9.range("a2:q2").value = sheet3.range("a200:q200").value                         sheet3.range("a200:q200").clearcontents                          else                          sheet9.range("b2").entirerow.insert                         sheet9.range("a2:q2").value = sheet3.range("a200:q200").value                         sheet3.range("a16:q16").clearcontents                         sheet9.range("b2:q2").interior.color = xlnone                         sheet9.range("b2:q2").font.bold = false                         sheet9.range("b2:q2").font.color = vbblack                         sheet9.range("b2:q2").rowheight = 14.25                      end if                      if sheet9.range("b2").value = ""                        sheet9.range("b2").entirerow.delete                      end if                  if ((.value = "complete - design") or (.value = "p4p") or (.value = "ready setup")) .entirerow.delete              end if         end     next lrowprojectsoverview end  end sub 


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -