A Wend statement is used without a corresponding While statement. Check other control structures within the While...Wend structure and verify that they are correctly matched. For example, an If without a matching End If inside the While...Wend structure will generate this error.