Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 132
Default Conditional Formatting Question


You should try "expression" condiftional formatting instead of "cell value."
This is the way you use conditional formatting to compare values in a cell
that "isn't itself." This sample changes the cond. formatting of cell C1
based on the value of B1.

Regards,
Bill



Dim strFormat As String
Dim strData As String

strFormat = "c1"
strData = "b1"

Range(strFormat).FormatConditions.Delete
Range(strFormat).FormatConditions.Add Type:=xlExpression,
Formula1:="=if( and( " & strData & "1, " & strData & "<5 ), true, false )"
Range(strFormat).FormatConditions(1).Interior.Colo rIndex = 46




"mvyvoda" wrote:

All,

How do I, in VBA, conditional format a column based on another columns data?
For example I have dates in the column (DATE COLUMN) I need formatting,
however I have text in another column (TEXT COLUMN). I want to make the date
columns format dependant on the text column. Here's what I have thus far:

s_current = Format(DateSerial(Year(Date), Month(Date), 1), "yyyy-mm")
s_future = Format(DateSerial(Year(Date), Month(Date) + 2, 1), "yyyy-mm")
Range("R:R").Select 'THIS IS DATE COLUMN
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlBetween, _
Formula1:=s_current, Formula2:=s_future
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
Formula1:= TEXT COLUMN DATA <<< ---- NEED HELP HERE, I THINK
Selection.FormatConditions(2).Interior.ColorIndex = 7

I have two conditions in which I need to color code the DATE COLUMN:
1.) in between s_current & s_future
2.) if the value of the corresponding cell in TEXT COLUMN is "IN"

Any help would be much appreciated.

Thanks,
-m

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Conditional Formatting Question

Question was answered that same day in a later (new) posting of the
question.

--
Regards,
Tom Ogilvy

"Bill Pfister" wrote in message
...

You should try "expression" condiftional formatting instead of "cell
value."
This is the way you use conditional formatting to compare values in a cell
that "isn't itself." This sample changes the cond. formatting of cell C1
based on the value of B1.

Regards,
Bill



Dim strFormat As String
Dim strData As String

strFormat = "c1"
strData = "b1"

Range(strFormat).FormatConditions.Delete
Range(strFormat).FormatConditions.Add Type:=xlExpression,
Formula1:="=if( and( " & strData & "1, " & strData & "<5 ), true,
false )"
Range(strFormat).FormatConditions(1).Interior.Colo rIndex = 46




"mvyvoda" wrote:

All,

How do I, in VBA, conditional format a column based on another columns
data?
For example I have dates in the column (DATE COLUMN) I need formatting,
however I have text in another column (TEXT COLUMN). I want to make the
date
columns format dependant on the text column. Here's what I have thus far:

s_current = Format(DateSerial(Year(Date), Month(Date), 1), "yyyy-mm")
s_future = Format(DateSerial(Year(Date), Month(Date) + 2, 1), "yyyy-mm")
Range("R:R").Select 'THIS IS DATE COLUMN
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlBetween, _
Formula1:=s_current, Formula2:=s_future
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
Formula1:= TEXT COLUMN DATA <<< ---- NEED HELP HERE, I THINK
Selection.FormatConditions(2).Interior.ColorIndex = 7

I have two conditions in which I need to color code the DATE COLUMN:
1.) in between s_current & s_future
2.) if the value of the corresponding cell in TEXT COLUMN is "IN"

Any help would be much appreciated.

Thanks,
-m



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
Conditional Formatting Question libby Excel Worksheet Functions 1 July 23rd 09 07:11 PM
Conditional Formatting: Question VegasSageV Excel Discussion (Misc queries) 2 October 15th 08 05:45 AM
Conditional Formatting Question DFrank Excel Worksheet Functions 6 June 28th 08 06:19 AM
Conditional Formatting Question. Ryan Hess Excel Worksheet Functions 3 November 13th 07 08:49 PM
Conditional formatting question SGT Buckeye Excel Discussion (Misc queries) 3 August 30th 06 04:36 PM


All times are GMT +1. The time now is 12:24 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"