Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 791
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I convert conditional formatting into explicit formatting? Patrick Harris Excel Discussion (Misc queries) 0 April 9th 09 12:00 AM
Protect Cell Formatting including Conditional Formatting Mick Jennings Excel Discussion (Misc queries) 5 November 13th 07 05:32 PM
conditional Formatting based on cell formatting Totom Excel Worksheet Functions 3 January 20th 07 02:02 PM
conditional Formatting based on cell formatting Totom Excel Worksheet Functions 0 January 15th 07 04:35 PM
Conditional Formatting that will display conditional data BrainFart Excel Worksheet Functions 1 September 13th 05 05:45 PM


All times are GMT +1. The time now is 02:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"