Try throwing an End If in there right before the Loop command. It looks to me like it's considering your Loop command to be part of the preceding Else statement.