excel - Insert copied row based on cell value -


the vba code below (modified here) insert blank row above row has value of "0" in column e. instead of inserting blank row, there way copy row "0" , insert above itself? can vba code modified this?

sub blankline()      dim col variant     dim blankrows long     dim lastrow long     dim r long     dim startrow long          col = "e"         startrow = 1         blankrows = 1              lastrow = cells(rows.count, col).end(xlup).row              application.screenupdating = false              activesheet r = lastrow startrow + 1 step -1 if .cells(r, col) = "0" .cells(r, col).entirerow.insert shift:=xldown end if next r end application.screenupdating = true  end sub 

just add line

.cells(r, col).entirerow.copy 

before .insert line


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -