
As shown in figure, loop search, when the value in the cell is BCD, insert a column in front, the result diagram below

CodePudding user response:
Sub BCDInsertColumn ()
Dim col As Long, lstcol As Long
Const target_row As Long=3 'BCD line
Lstcol=Cells (target_row, Columns. The Count) End (xlToLeft). The Column
For col=lstcol To Step 1-1
If Cells (target_row, col)="BCD" Then
The Columns (col). Insert
End the If
Next col
End Sub