答案 0 :(得分:0)
如果我正确地理解你,这是一种做法。
Sub deleteColumn()
Dim r As Range, c As Range, Col As Collection
On Error GoTo errTrap
Set r = ActiveSheet.Range("A2:A15") '<<=== exclude heading, chg to suit
Set r = r.SpecialCells(xlCellTypeConstants)
Set Col = New Collection
For Each c In r
Col.Add c.Value, CStr(c.Value)
Next c
Exit Sub
errTrap:
Select Case Err
Case 1004, 457 'all blanks, or duplicate found
r.EntireColumn.Delete
End Select
End Sub