I need some help to fix this code to copy and clear content only in a range instead of copying and clearing the whole row.
What the code does now, is that if column "I" is greater than column "J", in row 2-14, it copys the rows and PasteSpecial from row 16 and onwards.
I want to copy only cells in A2-L14, and paste from row 16 like it does now. And than ClearContent only in the range A2-L14 instead of EntireRow.
/J
What the code does now, is that if column "I" is greater than column "J", in row 2-14, it copys the rows and PasteSpecial from row 16 and onwards.
I want to copy only cells in A2-L14, and paste from row 16 like it does now. And than ClearContent only in the range A2-L14 instead of EntireRow.
VBA Code:
Dim i As Long, lRow As Long, ws As Worksheet
Set ws = Sheets("Blad1")
lRow = ws.Range("I" & Rows.Count).End(xlUp).Row + 1
If lRow < 16 Then lRow = 16
For i = 2 To 14
If ws.Range("I" & i) > ws.Range("J" & i) Then
ws.Range("A" & lRow).EntireRow.Value = ws.Range("I" & i).EntireRow.Value
ws.Range("I" & i).EntireRow.ClearContents
lRow = lRow + 1
End If
Next i
/J