Sub DeleteColumns()
Dim i As Long, maxCol As Long
Dim str As String
maxCol = Cells(4, Columns.Count).End(xlToLeft).Column
For i = maxCol To 1 Step -1
str = Cells(4, i)
If (str Like "*min*") Or (str Like "*max*") Then
Cells(4, i).EntireColumn.Delete
End If
Next i
End Sub
写好时发现已经有知友回答了, 而且他的回答很赞. 但是既然写了就贴出来吧, 结果都一样, 细节处理略有不同.
Sub test()
num = 256
For i = 1 To 256
If Cells(4, num).Value Like "*max*" Or Cells(4, num).Value Like "*min*" Then
Columns(num).Delete
End If
num = num - 1
Next
End Sub
请测试