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: 2
Default Increment value inside conditional format

I'm using Excel 97.

I'm trying to apply conditional formatting to a range of cells. I will also
need to increment (by 1) the named range inside of the formula in the
conditional format. The code below has no problem applying the conditional
format to the entire range, the part I'm stumbling over is how to get it to
increment.

All references to contrib are named ranges or named cells in other sheets.
The cells are named as follows: contrib1, contrib2, etc.

---Here's an example of what happens after the macro executes---
I go to Format / Conditional Format and find:

Formula Is =LEN(contrib & n)=0
The above formula is applied to every cell in the entire range

---Here's an example of what I want to find---
Format / Conditional Format

Formula Is =LEN(contrib1)=0 << inside cell(K3)
Formula Is =LEN(contrib2)=0 << inside cell(K4)
Formula Is =LEN(contrib3)=0 << inside cell(K5)
Where contrib is incremented by 1 for each cell in the entire range.

I'm very close to getting it right but I just can't figure out how to append
my variable (num) to contrib. I think what I already have setup, as far as
incrementing, will work fine. I just don't know how to assign a pointer to
my variable inside of the parenthesis.

Here's the code I'm using:
--------------------------------------------------------------
Option Explicit

Sub CondFormat()
Dim num As Integer
Dim cell As Range
num = 1
For Each cell In Range("K3:D55")
cell.FormatConditions.Delete
cell.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=LEN(contrib & num)=0"
cell.FormatConditions(1).Interior.ColorIndex = 2
num = num + 1
Next cell
End Sub
--------------------------------------------------------------

Thank you for any help! I appreciate it!

Bill Burns






 
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
Creating a conditional formula to increment #s in a test script Derek Megyesi Excel Discussion (Misc queries) 0 March 16th 10 08:27 PM
format text inside Concatenate andy62 Excel Worksheet Functions 1 April 11th 08 02:51 PM
New Conditional Format Overriding Previous Conditional Format Rene Excel Discussion (Misc queries) 3 February 27th 08 06:08 PM
Date Format Inside of a SUMIF Statement Minitman Excel Worksheet Functions 9 June 13th 05 07:52 PM
How do I create a bulleted list text format inside cell? DEH Excel Discussion (Misc queries) 5 February 1st 05 07:37 AM


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