I'm trying to write some code that deletes the unspecified columns based on the header and for one reason or another the code does not execute.
VBA Code:
wbDest.Activate
lastColumn = Cells(1, Columns.Count).End(xlToLeft).Column
For i = 1 To lastColumn
If Cells(1, i).Value <> "Ordered Date:" And Cells(1, i).Value <> "Ship Confirm Date" And Cells(1, i).Value <> "Order Header" And Cells(1, i).Value <> "Customer PO Number (Line)" _
And Cells(1, i).Value <> "Ordered Item" And Cells(1, i).Value <> "Ordered Item Description" And Cells(1, i).Value <> "Requested Quantity" _
Then Columns(i).EntireColumn.Delete Shift:=xlToLeft
Next i