我有多列和多行(> 200行)。如果某列的数据少于30行,我想删除整列。请帮助
Sub Delete_EntireColumn()
Dim iCntr
For iCntr = 1 To 10 Step 1
Columns(1).EntireColumn.Delete
Next
End Sub
答案 0 :(得分:2)
尝试
fields
编辑
如果行没有连续填充:
Sub Delete_EntireColumn()
Dim LCol as Long, LRow as Long, i as Long
With Workbooks(REF).Sheets(REF)
LCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
For i = LCol To 1 Step - 1
LRow = .Cells(.Rows.Count, i).End(xlUp).Row
If LRow < 30 Then
.Columns(i).EntireColumn.Delete
End If
Next i
End With
End Sub