Do you mean instead of
For Each cell In .Range("B2:C150")
check colours also in other ranges (B12:B1000 and I12:I10000)?
Try like this:
Private Sub Worksheet_Change(ByVal Target As Range)
Set rng1 = Union(Range("B2:C150"), Range("B12:B1000"), Range("I12:I1000"))
If Not Intersect(Target, [B2]) Is Nothing Then
With rng1
Set c = .Find(Target.Value, LookIn:=xlValues)
If Not c Is Nothing Then
c.Select
End If
End With
End If
End Sub
Sub RefreshDropDown()
Dim AStr As String
Dim cell As Range
Set rng1 = Union(Range("B2:C150"), Range("B12:B1000"), Range("I12:I1000"))
With Sheet9
For Each cell In rng1
If cell.Interior.Color = 12566463 Then AStr = AStr & "," & cell.Value
Next cell
AStr = Right(AStr, Len(AStr) - 1)
With .Range("B2").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:=AStr
End With
End With
End Sub
Bookmarks