View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Conditional Formatting


The function wants a range, you gave it an address

instead of
Mycolorcell=Trfccol.Offset(1,0).address

FndIndex= ConditionalColor(MyColorCell)

use this
set Mycolorcell=Trfccol.Offset(1,0)
FndIndex= ConditionalColor(MyColorCell)

or
FndIndex= ConditionalColor(Trfccol.Offset(1,0))

this instructio return an address
Mycolorcell=Trfccol.Offset(1,0).address
The address would be something like "C5". This is not a range. A range is
something like Range("C5"). You can set a Range to a new variable with a set
statement


set trfcol = Range("C5")
"Michael" wrote:

I found this great function in
her:http://www.vbaexpress.com/kb/getarticle.php?kb_id=190
It returns the conditional formatting Index color of a cell, however, this
works only if I insert it in a cell, I want to be able to use it inside a
code. What do I have to do?

I basically want to do this:
I want to have the same cell color as the one that has the Conditional
Format set.

For Each TrfcCol In TrfcCol
Trfccol.Interior.ColorIndex=Trfccol.Offset(1,0).In terior.ColorIndex

Next

This is not working and that is why I wanted to return the interior color of
the cell next to the one I want colored.
So I tried this:

Mycolorcell=Trfccol.Offset(1,0).address

FndIndex= ConditionalColor(MyColorCell)


But this gives the following error: ByRef argument type mistmatch

I am lost.....

Michael Arch.