如果找到匹配的“ SUP”和“ AL”,我想删除行范围1:6和列范围A:AE中的单元格内容
范围是黄色的供参考,请看下图
答案 0 :(得分:3)
有点困惑,但这是你的意思吗?
Sub FindReplaceAll()
Application.ReplaceFormat.Interior.Pattern = xlNone
With ActiveWorkbook.Sheets(1).Range("A1:AE6")
.Cells.Replace what:=UCase("SUP"), Replacement:="", ReplaceFormat:=True
.Cells.Replace what:=UCase("SUP"), Replacement:="", ReplaceFormat:=False
.Cells.Replace what:=UCase("AL"), Replacement:="", ReplaceFormat:=True
.Cells.Replace what:=UCase("AL"), Replacement:="", ReplaceFormat:=False
End With
End Sub
如果需要,您也可以申请LookAt:=xlPart
或LookAt:=xlWhole
。