Trying to figure out why Excel freezes the second time I run the code
<p>Sorry if the code is janky, I'm pretty new.  I'm trying to write a macro that copy's a sheet, removes some unnecessary parts, and exports the sheet into vba.<br>
It works fine the first time, but if I try to run the code twice while in the same instance of excel the whole thing freezes.  It doesn't matter if the csv file exists, and I've noticed that the error happens when the file saves as csv.</p>

<pre><code>Option Explicit

Sub Create_CSV()
Dim WbPath As String
    Application.ScreenUpdating = False
    Dim fso As New Scripting.FileSystemObject
    WbPath = ThisWorkbook.Path &amp; "\" &amp; fso.GetBaseName(ActiveWorkbook.Name) &amp; " GRID UPLOAD.csv"
    If FileExist(WbPath) Then
        SetAttr WbPath, vbNormal
        Kill WbPath
    End If

    Sheets("GRID UPLOAD").Copy after:=Worksheets("GRID UPLOAD")
    ActiveSheet.Name = "GRID EXPORT"
    With Sheets("GRID Export")
        .Rows("1:3").Delete Shift:=xlUp
        .Cells.ClearFormats
        .Shapes("GRIDBUTTON").Delete
        .UsedRange.Value = .UsedRange.Value
        .Move
    End With
   ' Application.DisplayAlerts = False
    ActiveWorkbook.SaveAs Filename:=WbPath, _
    FileFormat:=xlCSV, CreateBackup:=False
   ' Application.DisplayAlerts = True
    Application.ScreenUpdating = True



End Sub


Function FileExist(FilePath As String) As Boolean


Dim TestStr As String

  On Error Resume Next
    TestStr = Dir(FilePath)
  On Error GoTo 0

'Determine if File exists
  If TestStr = "" Then
    FileExist = False
  Else
    FileExist = True
  End If
</code></pre>