The following code does not do what I expect?
I'd expect the union range A1:A3 and E1:E3 to be filled with colour, but instead, it fills A1:A6?
This is only test code illustrating the issue. The real macro I am working on is populating an array with values from the union, but it does not move the the top of the second range once it hits the bottom of the first column. Like this example it just continues down the first column and my array is not filled with the correct values?
TX for assistance...
Code: Select all
Sub Test()
Dim rgUnion As Range
Dim i As Integer
Set rgUnion = Union(Range("A1:A" & 3), Range("E1:E" & 3))
For i = 1 To rgUnion.Cells.Count
rgUnion.Cells(i).Interior.Color = vbRed
Next i
End Sub