Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Change font colour


Hello,

Is there a way I can change the font colour to red in the entire row
based on a value in a cell using an IF statment without using the
Conditional Formatting ?

Thanks,


--
Altec101
------------------------------------------------------------------------
Altec101's Profile: http://www.excelforum.com/member.php...o&userid=34539
View this thread: http://www.excelforum.com/showthread...hreadid=546494

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Change font colour

Nope... Formulas return values. They do not manipulte the format of cells.
Why not use conditional formats???
--
HTH...

Jim Thomlinson


"Altec101" wrote:


Hello,

Is there a way I can change the font colour to red in the entire row
based on a value in a cell using an IF statment without using the
Conditional Formatting ?

Thanks,


--
Altec101
------------------------------------------------------------------------
Altec101's Profile: http://www.excelforum.com/member.php...o&userid=34539
View this thread: http://www.excelforum.com/showthread...hreadid=546494


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Change font colour


So if I have a date in let say cell B2 and I have a if statment in a
macro that looks at the date in that cell and compares it with the
currenty system date, if the dates match I want it to colour the row
red if not skip that row and check the next one.

This can not be done ??????

I'm trying to make it as easy as posiable for some else can just run a
macro with out havn't to setup conditional formatting.


--
Altec101
------------------------------------------------------------------------
Altec101's Profile: http://www.excelforum.com/member.php...o&userid=34539
View this thread: http://www.excelforum.com/showthread...hreadid=546494

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Change font colour

Sub ColourRed()
If ActiveCell.Value = Date Then
ActiveCell.EntireRow.Interior.ColorIndex = 3
End If
End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with googlemail if mailing direct)

"Altec101" wrote in
message ...

So if I have a date in let say cell B2 and I have a if statment in a
macro that looks at the date in that cell and compares it with the
currenty system date, if the dates match I want it to colour the row
red if not skip that row and check the next one.

This can not be done ??????

I'm trying to make it as easy as posiable for some else can just run a
macro with out havn't to setup conditional formatting.


--
Altec101
------------------------------------------------------------------------
Altec101's Profile:

http://www.excelforum.com/member.php...o&userid=34539
View this thread: http://www.excelforum.com/showthread...hreadid=546494



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Change font colour

Sorry... I misunderstood your question. So if I have it straight you want a
macro to look though a group of cells and colour the entire row red if the
cell value equals the system date... This is untested but it should be close.

Sub MakeRed()
dim rngToSearch as range
dim rng as range

set rngtosearch = range("B2", cells(rows.count, "B").end(xlUp))
for each rng in rngToSearch
if rng.value = date(now()) then rng.entirerow.font.colorindex = 3
next rng
end Sub
--
HTH...

Jim Thomlinson


"Altec101" wrote:


So if I have a date in let say cell B2 and I have a if statment in a
macro that looks at the date in that cell and compares it with the
currenty system date, if the dates match I want it to colour the row
red if not skip that row and check the next one.

This can not be done ??????

I'm trying to make it as easy as posiable for some else can just run a
macro with out havn't to setup conditional formatting.


--
Altec101
------------------------------------------------------------------------
Altec101's Profile: http://www.excelforum.com/member.php...o&userid=34539
View this thread: http://www.excelforum.com/showthread...hreadid=546494




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Change font colour


Hello Altec101,

Place this code in a standard VBA module. It will compare the active
cell's contents to the System Date. If there is a match, it change the
Row's Font color to red.


Code:
--------------------
Sub MakeRowFontRed()

If ActiveCell.Value = Date Then
With ActiveCell.EntireRow
.Select
.Font.Color = RGB(255, 0, 0)
End With
End If

End Sub

--------------------


Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=546494

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Change font colour


Thanks guys for the help.

How can I get it to loop through a range of cells say in column F.
I would like to to check each cell in column F one after the other(the
number of cells can be different each time) and be able to compare the
value in the cell which is a date to the systems date, if the value is
greater then or equal to the systems date colour the cell font red if
not do nothing.


--
Altec101
------------------------------------------------------------------------
Altec101's Profile: http://www.excelforum.com/member.php...o&userid=34539
View this thread: http://www.excelforum.com/showthread...hreadid=546494

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Change font colour


Sub ColourRed()
Dim i As Long
For i = 1 To Cells(Rows.Count, "F").End(xlUp)
If Cells(i, "F").Value = Date Then
Cells(i,"F").Font.ColorIndex = 3
End If
Next i
End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with googlemail if mailing direct)

"Altec101" wrote in
message ...

Thanks guys for the help.

How can I get it to loop through a range of cells say in column F.
I would like to to check each cell in column F one after the other(the
number of cells can be different each time) and be able to compare the
value in the cell which is a date to the systems date, if the value is
greater then or equal to the systems date colour the cell font red if
not do nothing.


--
Altec101
------------------------------------------------------------------------
Altec101's Profile:

http://www.excelforum.com/member.php...o&userid=34539
View this thread: http://www.excelforum.com/showthread...hreadid=546494



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Change font colour


Thanks,

One more question.

The value in each cell in column F is stored in a variable called
cellDate i then us the DateAdd function to add 4 days to the cellDate
and store the new date in a variable called returnDate.
I then want to compare the returnDate variable with the systems date
using the Date function and if the returnDate is = to the systems
date, colour the row red, if not skip the row and check the next row.
The loop statment should check the cell in each row and compare it
against the system date.


--
Altec101
------------------------------------------------------------------------
Altec101's Profile: http://www.excelforum.com/member.php...o&userid=34539
View this thread: http://www.excelforum.com/showthread...hreadid=546494

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Change font colour

Don't see why you need the variables

Sub ColourRed()
Dim i As Long
For i = 1 To Cells(Rows.Count, "F").End(xlUp)
If Cells(i, "F").Value + 4 = Date Then
Cells(i, "F").Font.ColorIndex = 3
End If
Next i
End Sub

--
HTH

Bob Phillips

(replace somewhere in email address with googlemail if mailing direct)

"Altec101" wrote in
message ...

Thanks,

One more question.

The value in each cell in column F is stored in a variable called
cellDate i then us the DateAdd function to add 4 days to the cellDate
and store the new date in a variable called returnDate.
I then want to compare the returnDate variable with the systems date
using the Date function and if the returnDate is = to the systems
date, colour the row red, if not skip the row and check the next row.
The loop statment should check the cell in each row and compare it
against the system date.


--
Altec101
------------------------------------------------------------------------
Altec101's Profile:

http://www.excelforum.com/member.php...o&userid=34539
View this thread: http://www.excelforum.com/showthread...hreadid=546494





  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Change font colour


It's returning an error for me, Type mismatch (Error 13)


--
Altec101
------------------------------------------------------------------------
Altec101's Profile: http://www.excelforum.com/member.php...o&userid=34539
View this thread: http://www.excelforum.com/showthread...hreadid=546494

  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Change font colour

You must have text there. Try this

Sub ColourRed()
Dim i As Long
For i = 1 To Cells(Rows.Count, "F").End(xlUp).Row
If IsNumeric(Cells(i, "F").Value) Then
If Cells(i, "F").Value + 4 = Date Then
Cells(i, "F").Font.ColorIndex = 3
End If
End If
Next i
End Sub



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Altec101" wrote in
message ...

It's returning an error for me, Type mismatch (Error 13)


--
Altec101
------------------------------------------------------------------------
Altec101's Profile:

http://www.excelforum.com/member.php...o&userid=34539
View this thread: http://www.excelforum.com/showthread...hreadid=546494



  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Change font colour


Not working, does not do anything.
In that cell there is a date and time value.


--
Altec101
------------------------------------------------------------------------
Altec101's Profile: http://www.excelforum.com/member.php...o&userid=34539
View this thread: http://www.excelforum.com/showthread...hreadid=546494

  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Change font colour

Well not much else I can think of, works fine for me.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Altec101" wrote in
message ...

Not working, does not do anything.
In that cell there is a date and time value.


--
Altec101
------------------------------------------------------------------------
Altec101's Profile:

http://www.excelforum.com/member.php...o&userid=34539
View this thread: http://www.excelforum.com/showthread...hreadid=546494



  #15   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Change font colour


What type of data do you have entered in the cell ?


--
Altec101
------------------------------------------------------------------------
Altec101's Profile: http://www.excelforum.com/member.php...o&userid=34539
View this thread: http://www.excelforum.com/showthread...hreadid=546494



  #16   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Change font colour


This here code does work, but I don't need to add 4 days onto the date
in the cell, i need to get the date 4 days from the cells date and then
check that date against the system date.
So, if cell F2 had a date of 5/30/2006 enter, I need to know the date 4
dates from that date, which is 6/4/2006.

That is why i was storing the date in a variable called ReturnDate, it
was the date 4 days from the cells value date.


Sub ColourRed()
Dim i As Long
For i = 1 To Cells(Rows.Count, "F").End(xlUp)
If Cells(i, "F").Value + 4 = Date Then
Cells(i, "F").Font.ColorIndex = 3
End If
Next i
End Sub


--
Altec101
------------------------------------------------------------------------
Altec101's Profile: http://www.excelforum.com/member.php...o&userid=34539
View this thread: http://www.excelforum.com/showthread...hreadid=546494

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
Change font colour Min Excel Discussion (Misc queries) 9 February 18th 10 01:50 AM
FONT COLOUR CHANGE natasha90 Excel Worksheet Functions 3 July 11th 08 09:19 PM
Change font colour Stefi Excel Discussion (Misc queries) 1 March 28th 07 01:54 AM
Change font colour [email protected] Excel Discussion (Misc queries) 3 December 23rd 06 07:07 PM
Change font colour for whole row Saleee Excel Worksheet Functions 2 October 10th 06 06:41 PM


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