0

如何调整此代码以突出显示直到最后一列的行,在我的情况下是“J”而不是 EntireRow?

 For Each wb In Workbooks
  If wb.Name <> "Book1.xlsm" Then
  wb.Activate

    For Each ws In ActiveWorkbook.Worksheets
      Set cl = ws.Cells.Find(What:=SearchString, _
        After:=ws.Cells(1, 1), _
        LookIn:=xlValues, _
        LookAt:=xlWhole, _
        SearchOrder:=xlByRows, _
        SearchDirection:=xlNext, _
        MatchCase:=False, _
        SearchFormat:=False)
             If Not cl Is Nothing Then
                 FirstFound = cl.Address
            Do
                  cl.EntireRow.Interior.ColorIndex = Cor
                 Set cl = ws.Cells.FindNext(After:=cl)
        Loop Until FirstFound = cl.Address
             End If
    Next ‘ etc etc
4

1 回答 1

2

更改
cl.EntireRow.Interior.ColorIndex = Cor
为:
ws.Range("A" & cl.Row & ":J" & cl.row).Interior.ColorIndex = Cor

于 2013-03-31T16:07:01.720 回答