VBA编译错误'没有时间'

ZX9*_*ZX9 3 excel vba excel-vba

我在excel中有一个VBA宏已经运行了一段时间.我一直在改变这些循环已经工作,突然代码没有编译:

编译错误:没有While而没有

我已经尝试过更改为Do While ...循环循环,但我得到了相同的东西

编译错误:没有Do的循环

这是我的代码的结构:

'This loop is fine
While '(code for evaluation)
'code to run in loop
Wend

While '(more eval code)
'code
  While '(eval code)
  'code
  Wend '<--This is where the compile error occurs
  'code
  While '(eval code)
  'code
  Wend
'code
Wend
Run Code Online (Sandbox Code Playgroud)

有谁知道可能是什么问题?(加分:代码缩进是否真的重要?)

Gar*_*ent 6

此消息Wend without While通常表示未终止的IF

在某处可能存在没有匹配的End IfIF

(这种错误消息有点烦人,因为它隐藏了真正的错误)