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: 8
Default Conditional Formatting in a Loop

Hi there,

I'm trying to use a loop to copy a conditional format from row to row. The
conditional format is to compare row A### to the row above and the row below
- if a duplicate is found then the colour should change.
The next part is to compare the value in D## to F## and if the result is not
the same the colour should change. Here is the code I have used (it's very
simple since I'm just new at programming):

' check to see if row is equal to row above or below
'
Range("A26").Select
While ActiveCell.Value < ""
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$A$26 =
$A$27"
Selection.FormatConditions(1).Interior.ColorIndex = 35
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="$A$27 =
$A$28"
Selection.FormatConditions(2).Interior.ColorIndex = 35
'
' check to see if rate charged was incorrect - compare d & f
'
ActiveCell.Offset(0, 3).Range("A1:C1").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=$D26<$F26"
Selection.FormatConditions(1).Interior.ColorIndex = 39
ActiveCell.Offset(1, -3).Range("A1").Select
Wend

I have tried removing the $ from the format but that didn't help either.

The format is copying but only looking at the data in row 26.

Please help!!!
 
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
Adding a loop to conditional delete code maw via OfficeKB.com New Users to Excel 21 August 15th 06 04:11 PM
conditional formatting & a loop lost!! Excel Programming 1 September 27th 04 08:59 PM
Conditional format cell ranges with loop? welded Excel Programming 7 June 19th 04 07:54 AM
Conditional alternating loop W.J.Surrarrer Excel Programming 0 June 3rd 04 01:29 AM
Loop for changing cell formatting Matt Excel Programming 1 January 15th 04 03:47 PM


All times are GMT +1. The time now is 06:19 AM.

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"