Your code has For & Next,
But why Compile error: Says that "Next without For" ?
The Bracket Sets are mixed up
For
If
Next
End If
Edit to add: OK, you got that.