Hi,
I have a workbook that is updated from an external source. The code works but it closes both the Source Workbook and the New Workbook. How do I edit my code to keep the Source Workbook open? Here is the code:
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
I have a workbook that is updated from an external source. The code works but it closes both the Source Workbook and the New Workbook. How do I edit my code to keep the Source Workbook open? Here is the code:
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