我有一个从外部源更新的工作簿。代码可以运行,但它会关闭源工作簿和新工作簿。如何编辑代码以保持源工作簿打开?代码如下:
Private Sub Worksheet_Calculate()
Dim target As Range
Set target = Range("A2:Q2")
If Not Intersect(target, Range("A2:Q2")) Is Nothing Then
Dim path As String
Dim filename1 As String
path = "C:\Users\rafin\"
filename1 = Range("G2") & Range("A2").Text
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=path & filename1 & ".xlsm", FileFormat:=xlOpenXMLWorkbookMacroEnabled
Application.DisplayAlerts = True
ActiveWorkbook.Close
谢谢