用VBA实现一个功能:历遍每个单元格,当单元格内容是xxx,yyy,zzz,aaa,bbb,ccc中任意一项的时候就删除
发布网友
发布时间:2022-05-27 03:30
我来回答
共1个回答
热心网友
时间:2023-10-03 08:13
Sub a()
Dim rg As Range, rgarea As Range
Set rgarea = Selection
For Each rg In rgarea
Select Case rg.Value
Case "xxx"
rg.Value = ""
Case "yyy"
rg.Value = ""
Case "zzz"
rg.Value = ""
Case "aaa"
rg.Value = ""
Case "bbb"
rg.Value = ""
Case "ccc"
rg.Value = ""
End Select
Next
End Sub
如上代码:将选中单元格区域中内容为xxx,yyy,zzz,aaa,bbb,ccc中任意一项时,该单元格值清空。