[B][COLOR=Royalblue]Sub[/COLOR][/B] a1077802b[B]()[/B]
[I][COLOR=seagreen]'https://www.mrexcel.com/forum/excel-questions/1077802-deleteing-unwanted-colums.html[/COLOR][/I]
[B][COLOR=Royalblue]Dim[/COLOR][/B] c [B][COLOR=Royalblue]As[/COLOR][/B] Range[B],[/B] x[B],[/B] ary[B],[/B] flag [B][COLOR=Royalblue]As[/COLOR][/B] [B][COLOR=Royalblue]Boolean[/COLOR][/B]
ary [B]=[/B] Split[B]([/B][COLOR=brown]"A,C,F,AB,BA,BF,BN,BS,CA,CB"[/COLOR][B],[/B] [COLOR=brown]","[/COLOR][B])[/B] [I][COLOR=seagreen]'list of columns[/COLOR][/I]
[B][COLOR=Royalblue]For[/COLOR][/B] [B][COLOR=Royalblue]Each[/COLOR][/B] c [B][COLOR=Royalblue]In[/COLOR][/B] Range[B]([/B][COLOR=brown]"A1:CC1"[/COLOR][B])[/B]
flag [B]=[/B] [B][COLOR=Royalblue]False[/COLOR][/B]
[B][COLOR=Royalblue]For[/COLOR][/B] [B][COLOR=Royalblue]Each[/COLOR][/B] x [B][COLOR=Royalblue]In[/COLOR][/B] ary
[B][COLOR=Royalblue]If[/COLOR][/B] c.Column [B]=[/B] Columns[B]([/B]x[B]).[/B]Column [B][COLOR=Royalblue]Then[/COLOR][/B] flag [B]=[/B] [B][COLOR=Royalblue]True[/COLOR][/B][B]:[/B] [B][COLOR=Royalblue]Exit[/COLOR][/B] [B][COLOR=Royalblue]For[/COLOR][/B]
[B][COLOR=Royalblue]Next[/COLOR][/B]
[B][COLOR=Royalblue]If[/COLOR][/B] flag [B]=[/B] [B][COLOR=Royalblue]False[/COLOR][/B] [B][COLOR=Royalblue]Then[/COLOR][/B] c [B]=[/B] [COLOR=brown]""[/COLOR]
[B][COLOR=Royalblue]Next[/COLOR][/B]
Range[B]([/B][COLOR=brown]"A1:CC1"[/COLOR][B]).[/B]SpecialCells[B]([/B]xlCellTypeBlanks[B]).[/B]EntireColumn.Delete
[B][COLOR=Royalblue]End[/COLOR][/B] [B][COLOR=Royalblue]Sub[/COLOR][/B]