the For/Next makes the $=$+1 redundant
Because of that, you can drop the preceeding EndIf