我已经对此低下头。在运行这个引用之后,我已经写了这个引用以解决工作表的一些问题,我不能再保存我的文档了。我不明白是什么导致了这个问题。有人有想法吗?
Dim c As Range
Set c = Sheets("Accounts").Range("B3")
Dim wsOld As Worksheet, wsNew As Worksheet
Dim strNameID As String
Application.DisplayAlerts = False
Do Until c.value = ""
'Correct Name ID
strNameID = UCase(Left(c.value, 4)) & Right(c.value, 4)
Sheets(c.value).Name = strNameID
c.value = strNameID
If c.Offset(0, 1).value <> "" Then
'Set old WS
Set wsOld = Sheets(c.Offset(0, 1).value)
'Set new WS
Sheets("TemplateINT").Copy after:=Sheets(Sheets.Count)
Set wsNew = Sheets("TemplateINT (2)")
'Copy values
wsNew.Range("C2:L100").value = wsOld.Range("C2:L100").value
'Delete old WS
wsOld.Delete
'Rename new WS
wsNew.Name = c.Offset(0, 1).value
'Correct column AC
c.Offset(0, 27).value = "='" & c.Offset(0, 1).value & "'!C4"
End If
Set c = c.Offset(1, 0)
Loop
Application.DisplayAlerts = True
Set c = Nothing
Set wsOld = Nothing
Set wsNew = Nothing
每次我在运行此代码后尝试保存文档时,Excel都会告诉我:
“保存 Document x 时检测到错误.Microsoft Excel可以通过删除或修复某些功能来保存文件。要在新文件中进行修复,请单击”继续“。取消保存该文件,单击取消。“
继续不会改变任何内容。