I am trying to format exported data and need to delete several columns. I want to keep columns with certain headings. For convenience if I have 15 columns and want to keep c
I had a similar problem and this is the code that worked for me. I think it is much simpler.
Range("A1").Select
Do Until ActiveCell.Value = ""
If ActiveCell.Value = "Forecast Status" _
Or ActiveCell.Value = "Amount " _
Or ActiveCell.Value = "Service Booking Value " _
Or ActiveCell.Value = "Transaction Number" _
Or ActiveCell.Value = "Last Modified by" _
Or ActiveCell.Value = "Last Modified Date" _
Or ActiveCell.Value = "T# Comparison" _
Or ActiveCell.Value = "Amount Comparison" _
Or ActiveCell.Value = "Forecast Status Comparison" _
Or ActiveCell.Value = "First Ship Date Comparison" Then
ActiveCell.Offset(0, 1).Select
Else
ActiveCell.EntireColumn.Select
Selection.Delete Shift:=xlToLeft
Selection.End(xlUp).Select
End If
Loop