Функция, возвращающая список (Коллекция) всех значений в Excel Selection, соответствующих этому условию:
If myCell.DisplayFormat.Interior.Color = myColor Then
была бы весьма полезна:
Sub TestMe()
'...OP Code
.TintAndShade = 0
End With
Dim unique As Collection
Set unique = ResultList(Selection)
If unique.Count > 1 Then Debug.Print unique.Item(2)
End Sub
Public Function ResultList(selectedRange As Range, _
Optional myColor As Long = 13551615) As Collection
Dim myCell As Range
Dim myResultList As New Collection
For Each myCell In selectedRange
If myCell.DisplayFormat.Interior.Color = myColor Then
myResultList.Add myCell.Value2
End If
Next myCell
Set ResultList = myResultList
End Function
Таким образом, Selection
избегается, и его можно использовать дальше.