Sub DoThis() Dim r来自, s, t As Object Set r = Sheets(1).Range(a1) '这一行可改 Set s = Sheets(2).Range(g1) '这一行可改 While s Debug.Print s Set t = r While t If InStr(t, s) 0 Then Rows(t.Row).Font.Color = 255 End If Set t = t.Offset(1, 0) Wend Set s = s.O需包阳ffset(1, 0) Wend End Sub
Sub 标记相同姓名() Dim i As Long Dim rng As Range Dim XingMing As String With Application .ScreenUpdating = False End With
For i = 1 To Sheet2.UsedRange.Rows.Count Sheets(sheet2).Select XingMing = Cells(i, 7) If XingMing Then Sheets(sheet1).Select Set rng = Cells.Find(What:=XingMing, After:=ActiveCell, LookIn:=xlValues, LookAt:= _ xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _ , SearchFormat:=False) If Not rng Is Nothing Then Rows(rng.Row).Select With Selection .Interior.Color = vbRed End With End If End If Next With Application .ScreenUpdating = True End With End Sub