如何调整此代码以突出显示直到最后一列的行,在我的情况下是“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
答案 0 :(得分:2)
更改
cl.EntireRow.Interior.ColorIndex = Cor
于:
ws.Range("A" & cl.Row & ":J" & cl.row).Interior.ColorIndex = Cor