簡體   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