Seu erro de sintaxe é com esta linha:
If iFullCount < Cells(1, 15).Value And Sum(Range(Cells(p, iCol),Cells(p-Cells(1, 15).Value,iCol))=0 And Sum(Range(Cells(p+iFullCount, iCol),Cells(p+iFullCount(1, 15).Value,icol))=0
Quebrando:
Sum(Range(Cells(p, iCol),Cells(p-Cells(1, 15).Value,iCol))
Você está faltando colchetes e Sum
não é uma função do VBA. Em vez disso, você usaria Application.Sum
Eu escrevi de forma um pouco diferente com base no que eu acredito que você realmente precisa. Deixe-me saber se isso funciona para você.
Sub EraseSpikes()
'
'
'
'
Dim iCol As Long, Last As Long, i As Long, j As Integer, startOfBlock As Integer
startOfBlock = -1 'Initialise startOfBlock. -1 means we're not in a block yet
iCol = ActiveCell.Column
Last = Cells(Rows.Count, iCol).End(xlUp).Row
For i = 4 To Last 'Begin loop from row 4 (?) to the end
If Cells(i, iCol) = 1 Then 'If we find a 1...
If startOfBlock = -1 Then 'And the block hasn't yet been started...
startOfBlock = i 'Mark this line as the start of our block
End If
Else 'If we don't find a 1...
If startOfBlock = -1 Then 'And we're not in a block...
GoTo nextLoop: 'We skip the rest of this until we're in a block
End If
If (i - startOfBlock) < Cells(1, 15).Value Then 'We didn't skip, so we're in a block.
'we check if (current row number - start row number)
'is less than the value in Cell(1,15) (Not equal to?)
For j = startOfBlock To i 'It was, so we loop through all the rows in that block blanking them
Cells(j, iCol).Value = ""
Next j
End If
startOfBlock = -1 'Reset to not being in a block
End If
nextLoop:
Next i
End Sub