Change the Cell property to No fille if Match is F

2019-08-18 06:26发布

I want to delete the Content of the Cell within Row Range 1:6 and Column Range A:AE if match is Found "SUP" and "AL"

Range is Colored in yellow for the reference please have a look at the below image

Sample Image

标签: excel vba
1条回答
乱世女痞
2楼-- · 2019-08-18 06:35

Little bit confused but would this be what you meant?

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

If need be you can apply LookAt:=xlPart or LookAt:=xlWhole too.

查看更多
登录 后发表回答