在VBA中执行复制语句后代码中断?



我试图确定是否存在一个名为Books的工作表,如果不存在,我想复制名为Items的工作表并将其重命名为Books。我的问题是,在这行之后,代码突然跳出并停止,根本没有给我一个错误。

使用工作簿引用限定工作表,或者使用ws_MCAT。

Dim i As Long
If Not ws_McatPrepareExists Then
With ws_MCAT
i = .Index
.Copy After:=.Parent.Sheets(i)   'duplicate the worksheet after the original
.Parent.Sheets(i + 1).Name = "Mcat_Prepare" 'rename the new worksheet
End With
End If