Public Sub subDeleteDuplicateColumns(WsData As Worksheet)
Dim intColumns As Integer
Dim strColumns As String
Dim arr() As String
Dim x As Integer
intColumns = WsData.Range("A1").CurrentRegion.Columns.Count
WsData.Rows(2).Insert
With WsData.Range("B2").Resize(1, intColumns - 1)
.Formula = "=IF(COUNTIF($A$1:B1,B$1)>1,COLUMN()," & """""" & ")"
.Value = .Value
End With
With WsData
arr = Split(Application.WorksheetFunction.TextJoin(",", True, .Cells(2, 2).Resize(1, intColumns - 1)), ",")
.Rows(2).Delete
For x = UBound(arr) To LBound(arr) Step -1
.Cells(1, Val(arr(x))).EntireColumn.Delete
Next x
End With
End Sub