title: VBA Loop to Delete Multiple Columns
body: <p>I want to search/loop through all the columns headers located on row 1 of the opened file and delete it if it matches dColumns, which is a list of columns I do not needed and I put in a range. </p>
  
  <pre><code>Sub LLextract()
  
  'Last cell in column
  Dim WS As Worksheet
  Dim LastCell As Range
  Dim LastCellRowNumber As Long
  
  Set WS = ThisWorkbook.Worksheets("Consolidated Data")
  With WS
      Set LastCell = .Cells(.Rows.Count, "A").End(xlUp)
      LastCellRowNumber = LastCell.Row + 0
  End With
  
  Dim wb As Workbook, wb2 As Workbook
  Dim vFile As Variant
  
  'Set source workbook
  Set wb = ActiveWorkbook
  
  'Open the target workbook
  vFile = Application.GetOpenFilename("CSV Files (*.csv), *.csv", , _
        "Select a CSV file", , False)
  
  'if the user didn't select a file, exit sub
  If TypeName(vFile) = "Boolean" Then Exit Sub
  Workbooks.Open vFile
  
  'Set selectedworkbook
  Set wb2 = ActiveWorkbook
  
  Dim dColumns As Range
  Set dColumns = wb.Worksheets("LL Columns to Delete").Range("A:A")
  
      Dim i As Integer
      Dim A As Range
      For i = 94 To 1 Step -1
          Set A = wb2.Cells(1, i)
          If wb2.Cells(1, i) = dColumns Then A.EntireColumn.Delete
      Next i
  
  'wb2.Worksheets(1).Range("A1").Select
  
  End Sub
  </code></pre>