Loops and Insert row troubles

Joined
Jul 19, 2007
Messages
1
Reaction score
0
Hi everyone I recently started to use macros in Excel, can't believe I lived tis long with out them. however I seem to be having a little trouble, I am trying to insert a row everytime a certain criteria is met, it meets the criteria and places in the value, but when it adds a line, it adds two lines for some reason.

Sub MoveRows()
For x = Sheet14.UsedRange.Rows.Count To 1 Step -1
For y = ActiveSheet.UsedRange.Rows.Count To 1 Step -1
If Sheet14.Cells(x, 1).Value <> "" Then
If (ActiveSheet.Cells(y, 3).Value = Sheet14.Cells(x, 1).Value) Then
Sheet14.Rows(x + 1).Copy
ActiveSheet.Cells(y, 5).Value = "zap"
ActiveSheet.Rows(y + 1).EntireRow.Insert SelectedRows
End If
End If
Next y
Next x
End Sub

Anyone know why? or have an idea to try?
 

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

Top