I have a workbook with two sheets. On Sheet A, I have changed the interior color of some cells. I would like to find cells in Sheet B with matching text and set them to have the
This can be done much much faster with:
Option Explicit
Sub MatchHighlight()
Dim FullListCell As Range
Dim HighlightMasterCell As Range
Dim FullList As Range
Dim HighlightMaster As Range
Dim lastRow As Range
'find last row in FullList
Set lastRow = Range("C").End(xlDown)
Set HighlightMaster = ThisWorkbook.Sheets("kleuren_medewerkers").Range("A1:A100")
Set FullList = Range(Range("C2"), ActiveSheet.Cells(lastRow.Row, 3)) 'change the number 3 to include more columns but use the lastrow of column C
For Each HighlightMasterCell In HighlightMaster
For Each FullListCell In FullList
If FullListCell .Value = HighlightMasterCell.Value Then
FullListCell.Interior.Color= HighlightMasterCell.Interior.Color
End If
Next
Next
End Sub