View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Thulasiram[_2_] Thulasiram[_2_] is offline
external usenet poster
 
Posts: 106
Default CODE given - Highlighting corresponding cells

Hello all,

I have a simple set like this:

A B C D E F ----- rng3
1.1 1 1 1 0 0 3
1.2 1 0 0 1 0 2
1.3 1 0 0 0 0 1
2.1 0 1 1 1 1 4
2.2 1 1 1 1 1 5
Rank 2 5 1 6 3 4 ----- rng1d

Assuming that letters A, C and D are highlighted (colorindex = 3), I
want to transform the same pattern to the corresponding cells in the
row starting with Rank. To achieve this I have written a code like
this:

Set rng1c = Sheet1.Columns(1).Find( _
What:="Rank", _
After:=Cells(Rows.Count, 1), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)

Set rng1d = rng1c.EntireRow

' rng1d.Interior.ColorIndex = 3 --- this highlights the entire row
starting with 'Rank'

But, I want the corresponding cells in the rng1d to be highlighted
according to the cells that have been highlighted in rng3.

For example:

1. As we have assumed that A, C and D have been highlighted, the values
2,1,6 have to be highlighted in rng 1d respectively.

2. If we assume B, D and E is highlighted, the values 5,6,3 have to be
highlighted in rng 1d respectively.

I tried a code like this.. It doesnt work for some reason..

rng1d.Cells.Interior.ColorIndex = rng3.Cells.Interior.ColorIndex

I would deeply appreciate any help for this.

Thanks,
Thulasiram