PDA

View Full Version : Select within the range.



jam03
11-25-2008, 10:30 AM
Hi guys, i have this small problem i can't seem to figure it out. I have this code :

//taking r1 & r2 as undefined ranges, and Column1 & Column2 as ranges that I've defined before.

I'm just comparing the two ranges Column 1 & 2, highlighting the same cells.
But here's the thing I'd like to highlight the whole row. And i don't know how to select the row of the range r1 (which is in the case a cell among the range Column1).


FontColor = Application.InputBox(Prompt:="Target color #" & vbNewLine & "", Type:=1)

For Each r1 In Column1.Cells
For Each r2 In Column2.Cells

If r1.Value = r2.Value Then

r1.Interior.color = FontColor
r2.Interior.color = FontColor

End If
Next
Next


Thanks in advance,

Regards

Bob Phillips
11-25-2008, 10:46 AM
FontColor = Application.InputBox(Prompt:="Target color #" & vbNewLine & "", Type:=1)

For Each r1 In Column1.Cells
For Each r2 In Column2.Cells

If r1.Value = r2.Value Then

r1.Entirerow.Interior.color = FontColor
r2.Interior.color = FontColor

End If
Next
Next

jam03
11-26-2008, 03:42 AM
Thanks again xld.

Regards