I am doing a simple loop code where I want Y to equal 10 and each time it goes through the loop to +1 i.e. 10,11,12,13
However I am getting compile errors on the variables X and Y if anyone could let me know why this is occuring it would be much appreciated.
Dim targetrow As Long
targetrow = ActiveSheet.Range("Total").Offset(-2, 0).Row
Y = 10
For X = 19 To targetrow Step 1
If Range("K" & X) <> "" Then
Range("K" & X).Copy
Workbooks(PtchFile).Activate
Range("G" & Y).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Y = Y + 1
X = X + 1
Else
End If
Next X