I have a vba code (not mine copied from another site) which seperates data from master file into multiple files based on specific column ,now after the data has been separated into multiple files the code execution has been completed , but the master file is open at the end which is not good , tried to various ways to apply code for save the master file and close the master file but not working , I have no idea about vba coding,the master file is FE_JUL.xlsx
Sub ExportDatabaseToSeparateFiles()
     'Export is based on the value in the KeyCol
    Dim myWb As Workbook
    Dim myCell As Range
    Dim mySht As Worksheet
    Dim myName As String
    Dim myArea As Range
    Dim myShtName As String
    Dim KeyCol As String
    Dim myField As Integer
    Application.ScreenUpdating = False
    Workbooks.Open Filename:="C:\FInal Estimate\Excel\2019\temp\FE_JUL.xlsx"
    Set myWb = Application.Workbooks("FE_JUL.xlsx")
    myWb.Activate
    myShtName = ActiveSheet.Name
    KeyCol = "A"
    Set myArea = Intersect(ActiveSheet.UsedRange, Range(KeyCol & "1").EntireColumn).Cells
    Set myArea = myArea.Offset(1, 0).Resize(myArea.Rows.Count - 1, 1)
    myField = myArea.Column - myArea.CurrentRegion.Cells(1).Column + 1
    For Each myCell In myArea
        On Error GoTo NoSheet
        myName = Worksheets(myCell.Value).Name
        GoTo SheetExists:
NoSheet:
        Set mySht = Worksheets.Add(Before:=Worksheets(1))
        mySht.Name = myCell.Value
        With myCell.CurrentRegion
            .AutoFilter Field:=myField, Criteria1:=myCell.Value
            .SpecialCells(xlCellTypeVisible).Copy _
                    mySht.Range("A1")
            mySht.Cells.EntireColumn.AutoFit
            .AutoFilter
        End With
        Resume
SheetExists:
    Next myCell
    For Each mySht In ActiveWorkbook.Worksheets
        If mySht.Name = myShtName Then
            Exit Sub
        Else
            mySht.Move
            ActiveWorkbook.SaveAs "C:\FInal Estimate\Excel\2019\temp\temp\" & ActiveSheet.Name & ".xlsx"
            ActiveWorkbook.Close
        End If
    Next mySht
    myWb.Save
    myWb.Close
End Sub
 
    