ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Color cell text based on date (https://www.excelbanter.com/excel-programming/345213-re-color-cell-text-based-date.html)

Byron[_5_]

Color cell text based on date
 
Thanks for the input, but I was actually trying to find a way with VBA to do
it automatically.

Thanks

"Gary''s Student" wrote:

Use conditional formatting:

Format Conditional Formatting... and enter value greater than =TODAY()
and select a distinct format.

Then copy the formatting down the column
--
Gary''s Student


"Byron" wrote:

I need a way to color all dates in a column if the date is later than today.
I can do it using the autofilter, but if there are no late dates, it colors
the whole workbook.

Help.

Byron


chijanzen

Color cell text based on date
 
Byron:
Try

Dim UserRange As Range, rng As Range
Set UserRange = Range("B2:B10")
For Each rng In UserRange
If IsDate(rng) And rng < Date Then
rng.Font.ColorIndex = 3
End If
Next

--

http://www.vba.com.tw/plog/


"Byron" wrote:

Thanks for the input, but I was actually trying to find a way with VBA to do
it automatically.

Thanks

"Gary''s Student" wrote:

Use conditional formatting:

Format Conditional Formatting... and enter value greater than =TODAY()
and select a distinct format.

Then copy the formatting down the column
--
Gary''s Student


"Byron" wrote:

I need a way to color all dates in a column if the date is later than today.
I can do it using the autofilter, but if there are no late dates, it colors
the whole workbook.

Help.

Byron



All times are GMT +1. The time now is 01:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com