I have the following VBA code to compare the content (string) between two cells. If it is the same, I must to copy certain cells and paste them in another sheet. However, this code is not working. Please may you advise on how to adjust it? 

```
Dim p As Integer
Dim i As Integer

For i = 12 To RealLastRow
If Worksheets("Pal_clave").Range("V" & i).Value = Worksheets("Pal_clave").Range("V" & i - 1).Value Then

Worksheets("Pal_clave").Range("D" & i).Copy Worksheets("Diagrama").Range("B" & p + 10)

Worksheets("Pal_clave").Range("K" & i).Copy Worksheets("Diagrama").Range("E" & p + 10)

Worksheets("Pal_clave").Range("T" & i).Copy Worksheets("Diagrama").Range("H" & p + 10)

Worksheets("Pal_clave").Range("V" & i).Copy Worksheets("Diagrama").Range("K" & p + 10)

Worksheets("Pal_clave").Range("AB" & i).Copy Worksheets("Diagrama").Range("N" & p + 10)

Worksheets("Pal_clave").Range("AJ" & i).Copy Worksheets("Diagrama").Range("B" & p + 20)

Worksheets("Pal_clave").Range("Y" & i).Copy Worksheets("Diagrama").Range("K" & p + 20)

p = p + 20

End If

Next i

```