Sub 查找关键字标色() Dim r As Range, s As String, sz sz = InputBox("请输入 要查找的内容") Set r = Cells.Find(sz, LookAt:=xlWhole, SearchOrder:=xlRows) If Not r Is Nothing Then s = r.Address Do r.Interior.Color = vbRed Set r = Cells.FindNext(r) Loop While r.Address <> s End If End Sub
Sub 查找关键字替换颜色() Dim cz, th cz = InputBox("请输入查找内容") th = InputBox("请输入替换内容") Application.ReplaceFormat.Interior.Color = vbGreen Cells.Replace What:=cz, Replacement:=th, LookAt:=xlWhole, SearchOrder _ :=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=True End Sub
|