automatically insert rows

  • Thread starter Thread starter Samuel
  • Start date Start date
S

Samuel

Hello,

I've a sheet with records from cell a to k, where i want to insert a row
between each record (there are 2000 records in the sheet) and the value
union in the first cell of the newly inserted row.

How can i do this?
 
Sub AddRows()
Dim lastRow as Long, i as Long
lastrow = cells(rows.count,1).end(xlup).row
for i = lastrow to 1 step -1
cells(i,1).Entirerow.Insert
cells(i,1).Value = "Union"
Next
End Sub

Test this on a copy of your data.
 

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