title: Run a loop to check columns based on header name, and insert columns if they are missing
body: <p>I am new to VBA and have been tasked with creating a macro to clean up and save .csv files. So far I have been able to put together the script from other answered questions here on Stack Overflow, but the final piece is eluding me.</p>
  
  <p>So far I can open, check for columns that need to be deleted, delete them, then save as a new file. What I need to do is check if columns are missing and insert them so that the csv files all consistently have the same header row.</p>
  
  <p>For example:</p>
  
  <p>Let's say that all of the necessary columns  have the first row cell values as "Alpha", "Bravo", "Charlie", "Delta", "Echo", "Foxtrot", "Golf"</p>
  
  <p>But sometimes the CSV files we receive only go from "Alpha" to "Echo"</p>
  
  <p>I need to check for this and then insert the columns "foxtrot" and "Golf" in their respective order. How would I go about doing this?</p>
  
  <p>It seems like with minor tweaks and a little more code, I can modify my column delete script (which I found <a href="https://stackoverflow.com/a/18213842/4292905">here</a>) to do this.</p>
  
  <pre><code>Dim rngFound As Range
        Dim rngDel As Range
        Dim arrColumnNames() As Variant
        Dim varName As Variant
        Dim strFirst As String
  
        arrColumnNames = Array("Hotel","India","Julliet")
  
        For Each varName In arrColumnNames
            Set rngFound = Rows(1).Find(varName, Cells(1, Columns.Count), xlValues, xlPart)
            If Not rngFound Is Nothing Then
                strFirst = rngFound.Address
                Do
                    If rngDel Is Nothing Then Set rngDel = rngFound Else Set rngDel = Union(rngDel, rngFound)
                    Set rngFound = Rows(1).Find(varName, rngFound, xlValues, xlPart)
                Loop While rngFound.Address &lt;&gt; strFirst
            End If
        Next varName
  
        If Not rngDel Is Nothing Then rngDel.EntireColumn.Delete
  
        Set rngFound = Nothing
        Set rngDel = Nothing
        Erase arrColumnNames
  </code></pre>
  
  <p>But it's a little beyond me as I've never worked with VBA; can someone provide some direction?</p>