Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Conditional Formatting
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I convert conditional formatting into explicit formatting? | Excel Discussion (Misc queries) | |||
Protect Cell Formatting including Conditional Formatting | Excel Discussion (Misc queries) | |||
conditional Formatting based on cell formatting | Excel Worksheet Functions | |||
conditional Formatting based on cell formatting | Excel Worksheet Functions | |||
Conditional Formatting that will display conditional data | Excel Worksheet Functions |