Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Color rows based on a cell value

Hello -
Windows XP
Excel 2003

I want to color a row based on a cell value.
Specifically, I have about 100 rows where I keep licensing data.
I have a column entitled 'DAYS TO EXPIRATION' and another 'DAYS TO
RENEWAL'
If the days to expiration or renewal are 60 or less, then I want the
whole row's font to change to red from 'automatic' (black).
I can change the color of the cell using conditional formatting.
The problem is some of the rows contain no expiration - the days to
expiration are blank because the license doesn't expire or must be
renewed.
So, I need either VBA or a condition formatting snippet to:
Check the column(s) for numbers, if there is a number, and if the
number is 60 or less (<60), then change the row's font color to red.
Thanks,
Paul
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Color rows based on a cell value

Hi Paul

Conditional formatting will do the job.

with 'Days to expiration' in column A, select row 1 and goto conditional
formatting Formula is:

=AND($A1<=60,$A1<"")

Format as desired, and use the format painter to format the desired range.

Hopes this helps

---
Per

skrev i meddelelsen
...
Hello -
Windows XP
Excel 2003

I want to color a row based on a cell value.
Specifically, I have about 100 rows where I keep licensing data.
I have a column entitled 'DAYS TO EXPIRATION' and another 'DAYS TO
RENEWAL'
If the days to expiration or renewal are 60 or less, then I want the
whole row's font to change to red from 'automatic' (black).
I can change the color of the cell using conditional formatting.
The problem is some of the rows contain no expiration - the days to
expiration are blank because the license doesn't expire or must be
renewed.
So, I need either VBA or a condition formatting snippet to:
Check the column(s) for numbers, if there is a number, and if the
number is 60 or less (<60), then change the row's font color to red.
Thanks,
Paul


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Color rows based on a cell value

I would suggest using a macro like this:

Sub MarkExpiredLicenses()

'This subroutine assumes that you have a column in addition
'to your 'DAYS TO EXPIRATION' and 'DAYS TO RENEWAL' columns that
'whose cells are not empty for EACH of the licenses in your worksheet
'Let us assume that that column is A
'Let us also assume that column B is your 'DAYS TO EXPIRATION' column

Dim license As range
Set license = range("A1")
Dim iLicense As Integer
iLicense = 0
Do
If license.Offset(iLicense, 1).Value <= 60 Then
license.Offset(iLicense, 1).Font.ColorIndex = 3
license.Offset(iLicense, 1).Font.Bold = True
Else
license.Offset(iLicense, 1).Interior.ColorIndex = 0
license.Offset(iLicense, 1).Font.Bold = False
End If
iLicense = iLicense + 1
If license.Offset(iLicense, 0).Value = "" Then Exit Do
Loop
End Sub

Hope this helped.
Best wishes,
Rolf

" wrote:

Hello -
Windows XP
Excel 2003

I want to color a row based on a cell value.
Specifically, I have about 100 rows where I keep licensing data.
I have a column entitled 'DAYS TO EXPIRATION' and another 'DAYS TO
RENEWAL'
If the days to expiration or renewal are 60 or less, then I want the
whole row's font to change to red from 'automatic' (black).
I can change the color of the cell using conditional formatting.
The problem is some of the rows contain no expiration - the days to
expiration are blank because the license doesn't expire or must be
renewed.
So, I need either VBA or a condition formatting snippet to:
Check the column(s) for numbers, if there is a number, and if the
number is 60 or less (<60), then change the row's font color to red.
Thanks,
Paul

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Color rows based on a cell value

Hi Paul

Conditional formatting will do the job.

with 'Days to expiration' in column A, select row 1 and goto conditional
formatting Formula is:

=AND($A1<=60,$A1<"")

Format as desired, and use the format painter to format the desired range.

Hopes this helps

---
Per

skrev i meddelelsen
...
Hello -
Windows XP
Excel 2003

I want to color a row based on a cell value.
Specifically, I have about 100 rows where I keep licensing data.
I have a column entitled 'DAYS TO EXPIRATION' and another 'DAYS TO
RENEWAL'
If the days to expiration or renewal are 60 or less, then I want the
whole row's font to change to red from 'automatic' (black).
I can change the color of the cell using conditional formatting.
The problem is some of the rows contain no expiration - the days to
expiration are blank because the license doesn't expire or must be
renewed.
So, I need either VBA or a condition formatting snippet to:
Check the column(s) for numbers, if there is a number, and if the
number is 60 or less (<60), then change the row's font color to red.
Thanks,
Paul


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
Excel: Syntax to change cell color based on color of another cell davew18 Excel Worksheet Functions 1 January 4th 07 01:24 PM
change fill color of a range of cells based on color of a cell? DarMelNel Excel Programming 0 March 2nd 06 06:35 PM
excel: How can I color code rows based on a value in a cell? Parker1333 Excel Discussion (Misc queries) 2 February 1st 05 10:37 PM
I want to chage a whole rows text color based on single cell valu. thediamondfam Excel Worksheet Functions 2 January 12th 05 12:15 AM
Browse Forms Controls and change TextBox color based on cell color StefanW Excel Programming 2 November 21st 04 07:06 PM


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