Macro To Insert Blank Row?

  • Thread starter Thread starter rtidrtid
  • Start date Start date
R

rtidrtid

anyone a dab hand at Excel? I need a had creating a macro. What i hav
is a column with numbers, for example

12222
12222
21111
21111
13333
13333

what i need is a macro which will insert a blank row after an identica
sequence of numbers, turning the above into

12222
12222

21111
21111

13333
13333


any ideas
 
try this. the key is working from the bottom up instead of the top down.

Sub insertrowifnotminusonerow()
lr = Cells(Rows.Count, "c").End(xlUp).Row
For i = lr To 2 Step -1
If Cells(i - 1, "c") <> Cells(i, "c") Then Rows(i).Insert
Next i
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top