Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub repeatingrows()
- Dim oldsheet As Worksheet
- Dim newsheet As Worksheet
- Set newsheet = Application.ActiveSheet
- Set oldsheet = ThisWorkbook.Worksheets(3)
- Set newsheet = ThisWorkbook.Worksheets(2)
- 'CHECK IF THE ROWS ARE SIMILAIR TO PREVIOUS SHEET
- Dim rrow As Integer
- Dim srow As Integer
- For rrow = 3 To 397
- For srow = 3 To 397
- If oldsheet.Cells(rrow, 2) = newsheet.Cells(srow, 2) Then
- If oldsheet.Cells(rrow, 5) = newsheet.Cells(srow, 5) Then
- If oldsheet.Cells(rrow, 6) = newsheet.Cells(srow, 6) Then
- With newsheet
- oldsheet.Range(oldsheet.Cells(rrow, 16), oldsheet.Cells(rrow, 19)).Copy
- .Range(.Cells(srow, 16), .Cells(srow, 19)).PasteSpecial xlPasteValues, xlPasteSpecialOperationAdd
- End With '^COPY AND PASTES THE ROW
- Else
- End If
- Else
- End If
- Else
- End If
- Next srow
- Next rrow
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement