|
要求:通过代码删除A列区域中空行和指定字符行
Sub CleanUp()
On Error Resume Next
With ActiveSheet
LastRw = .Cells(Rows.Count, "A").End(xlUp).Row
Set Rng1 = .Range(Cells(1, "A"), Cells(LastRw, "A"))
Set Rng2 = .Range(Cells(2, "A"), Cells(LastRw, "A"))
End With
With Rng1
'删除所在区域内空白单元格所在行
.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
'进行筛选,并删除指定字符所在行
.AutoFilter Field:=1, Criteria1:="Hello"
Rng2.SpecialCells(xlCellTypeVisible).EntireRow.Delete
.AutoFilter
End With
End Sub |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|