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: 9
Default How to change cell colour based on numer of months?

Hello all,

I need a function that have an initial date on a cell (ex: 25-05-2005) and
returns one year next to that date (ex:25-05-2006), and this is ok.

To this date that i have(25-05-2006) i need to count the number of months
that passed until now(in this case is 0 months) and if the month is 0 to 10,
fill in the current row the (25-05-2006) cell to red. If is in 11 to 12 fill
it in green. and if is it higher than 12, fill in yellow

my problem is, that the excelsheet does', select any cell and don't fill
anything

can you help me?
Thank You

PS: i'm trying in that way

Public Function give_date(initialdate, line)
......

Select Case numerofmonths
Case Is <= 10
Range("G" + Trim(Str(line))).Select
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
Case 11 To 15
Range("G" + Trim(Str(line))).Select
With Selection.Interior
.ColorIndex = 46
.Pattern = xlSolid
End With

Case Is 15
Range("G" + Trim(Str(line))).Select
With Selection.Interior
.ColorIndex = 10
.Pattern = xlSolid
End With

End Select

give_date = nextdate

End Function
 
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
Using CF to change colour in cell based on date? Steve[_26_] Excel Discussion (Misc queries) 4 March 21st 10 10:52 PM
date text to change colour when it gets over six months Nessa Excel Worksheet Functions 1 November 18th 09 03:47 PM
how do i change cell text colour based on value in other cell Oscarrot Excel Worksheet Functions 2 July 20th 09 03:21 PM
Can I change line numer or column name Dave Bonneville Excel Discussion (Misc queries) 2 November 1st 05 07:29 PM
Change the colour of a bunch of cells, based on one cell. Craig & Co. Excel Programming 2 October 14th 04 06:28 AM


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