title: open workbook and after open it goes back to the beginning of sub,
body: <pre><code>Option Explicit
  Sub DleteColumns()
  
  Dim objWorkbook As Workbook
  Dim i As Integer
  Dim keepColumn As Boolean
  Dim currentColumn As Integer
  Dim columnHeading As String
  Dim ws As Worksheet
  
  'This is temporary for testing this one below
  
      Application.DisplayAlerts = False
  
      currentColumn = 1
      'open the workbook with data
      DoEvents
      Set objWorkbook = Workbooks.Open( _
      "H:\C_Files\xls\a_C_Track_20171101.xls")
      'Do a pause
      Application.Wait (Now + TimeValue("0:00:10"))
      ThisWorkbook.Activate
      Set ws = ActiveSheet
      'Stop
      'read the data from the first columns
      For i = 1 To 1
  
      currentColumn = 1
          While currentColumn &lt;= ActiveSheet.UsedRange.Columns.Count
              columnHeading = ActiveSheet.UsedRange.Cells(1, currentColumn).Value
  
           'CHECK WHETHER TO KEEP THE COLUMN
              keepColumn = False
  
              If columnHeading = "#reason" Then keepColumn = True
              If columnHeading = "first_name" Then keepColumn = True
              If columnHeading = "last_name" Then keepColumn = True
              If columnHeading = "employer_name" Then keepColumn = True
              If columnHeadimg = "city" Then keepColumn = True
              If columnHeading = "state" Then keepColumn = True
              If columnHeading = "date_of_birth" Then keepColumn = True
              If columnHeading = "ssn" Then keepColumn = True
  
              If keepColumn Then
                  currentColumn = currentColumn + 1
              Else
                  ActiveSheet.Columns(currentColumn).Delete
              End If
  
              'LASTLY AN ESCAPE IN CASE THE SHEET HAS NO COLUMNS LEFT
               If (ActiveSheet.UsedRange.Address = "$A$1") And 
                   (ActiveSheet.Range("$A$1").text = "") Then Exit Sub
          Wend
  
             Next i
       Stop
      'ActiveWorkbook.Save
      'objWorkbook.Close
       ActiveWorkbook.Close SaveChanges:=True
      End Sub
  </code></pre>