繁体   English   中英

突出显示一行直到最后一列

[英]Highlight a row until last column

我如何调整此代码以突出显示直到最后一列的行,在我的情况下是“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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM