AW: @Sepp nachgefragt: Sub Colored
15.08.2018 20:26:08
Sepp
Hallo Gerhard,
klar geht das.
Sub Colored()
Dim rng As Range, rngC As Range, strFirst As String
Dim lngIndex As Long, varSearch As Variant
varSearch = Range("H1:H5")
With Range("C:C")
.Offset(0, -2).Resize(, 26).Interior.ColorIndex = xlNone
For lngIndex = 1 To Ubound(varSearch, 1)
strFirst = ""
If varSearch(lngIndex, 1) <> "" Then
Set rng = .Cells.Find(What:=varSearch(lngIndex, 1), LookIn:=xlValues, _
LookAt:=xlPart, MatchCase:=False, SearchFormat:=False)
If Not rng Is Nothing Then
strFirst = rng.Address
Do
If rngC Is Nothing Then
Set rngC = rng.Offset(0, -2).Resize(, 26)
Else
Set rngC = Union(rngC, rng.Offset(0, -2).Resize(, 26))
End If
Set rng = .Cells.FindNext(rng)
Loop While Not rng Is Nothing And rng.Address <> strFirst
End If
End If
Next
End With
If Not rngC Is Nothing Then rngC.Interior.Color = 10092543
Set rngC = Nothing
Set rng = Nothing
End Sub
VBA/HTML-CodeConverter, AddIn für Office 2002-2016 - in VBA geschrieben von Lukas Mosimann. Projektbetreuung:RMH Software & Media
Code erstellt und getestet in Office 16 - mit VBAHTML 12.6.0