C
CG Rosén
Hi Group,
Received below code from Tom Ogilvy. It gives me the addresses of the ranges
in Row(2) that is filled by grey color. What I´am trying to do is to compare
another
range to the ranges from the code below. If the new range is within some of
the
found ranges the "old" range should be set to "no color".
Are not clever enough to make an array of the given ranges or to "split"
them to
independent variables for further processing. Thankful for some help to move
along.
Brgds
CG Rosén
Dim rng As Range, cell As Range
Dim rngList() As Range, i As Long
For Each cell In Rows(2).Cells
If cell.Interior.ColorIndex = 15 Then
If rng Is Nothing Then
Set rng = cell
Else
Set rng = Union(rng, cell)
End If
End If
Next
If Not rng Is Nothing Then
MsgBox rng.Address
End If
Received below code from Tom Ogilvy. It gives me the addresses of the ranges
in Row(2) that is filled by grey color. What I´am trying to do is to compare
another
range to the ranges from the code below. If the new range is within some of
the
found ranges the "old" range should be set to "no color".
Are not clever enough to make an array of the given ranges or to "split"
them to
independent variables for further processing. Thankful for some help to move
along.
Brgds
CG Rosén
Dim rng As Range, cell As Range
Dim rngList() As Range, i As Long
For Each cell In Rows(2).Cells
If cell.Interior.ColorIndex = 15 Then
If rng Is Nothing Then
Set rng = cell
Else
Set rng = Union(rng, cell)
End If
End If
Next
If Not rng Is Nothing Then
MsgBox rng.Address
End If