LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Conditional Formatting Bug w/ relative formula?

Hello -

I have coded up the following to automatically set the Conditional
Formatting for a cell:

lLine = 28

With Range("D" & lLine )
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="=$D" & lLine &
"=""X"""
.FormatConditions(1).Interior.ColorIndex = 3
.FormatConditions.Add Type:=xlExpression, Formula1:="=$D" & lLine &
"=""Y"""
.FormatConditions(2).Interior.ColorIndex = 5
End With

When I run it, the actual Formula is =D37="X" rather than =D28="X". If
I do a Range().Select and then the Selection.FormatConditions.XXX it
works fine. Any idea what that is all about? Am I doing something
wrong here?

Thanks,
Joe

 
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 based on relative cell value still learning Excel Worksheet Functions 2 September 29th 09 05:46 PM
Conditional Formatting with relative cells HelenJ Excel Discussion (Misc queries) 8 June 17th 09 05:38 PM
Conditional Formatting Relative to adjacent cells Max Excel Discussion (Misc queries) 2 June 2nd 09 04:50 AM
How do I set conditional formatting relative to another cell -XL20 kboekhoff Excel Discussion (Misc queries) 2 January 5th 09 06:58 AM
Conditional formatting changing relative when copied to other cell robbin Excel Worksheet Functions 1 September 5th 07 11:36 PM


All times are GMT +1. The time now is 02:30 PM.

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

About Us

"It's about Microsoft Excel"