How can I adapt this code to highlight a row until last column, that in my case is “J” and not the 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
Change
cl.EntireRow.Interior.ColorIndex = Cor
to:
ws.Range("A" & cl.Row & ":J" & cl.row).Interior.ColorIndex = Cor
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.