General discussion


Excel 97 question

By tbenjock ·
I have a date field on a spreadsheet that accepts the entry of zero, and that places a literal string in the cell, (I have it displaying the string "need date"). If you look at the formula bar, the custom date code says 1/0/1900.

It also acceptsa regular entry of a date if I choose to enter one.

My question is:

I want to put a conditional format using code in these cells as well. I want the formatting to read something like...

If date <= today(), BOLD & ITALIC, if not NOTHING.

Since the value in the cell is a display value only, will I be able to do this?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

Excel 97 question

by Oliver W. In reply to Excel 97 question

got a small makro for use. I went to Extras/Conditional Formatting and inserted the conditions I want. This was recorded as a Makro and edited later on, to insert the actual date.

Sub UseConditionalFormating()
Dim MyDate As Date
'Range selects some cells on the Workbook
'Place here your Range, you want to be formated
MyDate = Date
'If You don't want to use less, or GreaterEaqual, just change then
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, _
' In here put the Format you want to set
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = True
End With
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreaterEqual _
, Formula1:=MyDate
' In here put the Format you want to set
With Selection.FormatConditions(2).Font
.Bold = True
.Italic = False
End With
End Sub

An other Way would be, to put the actual Date somwhere on your spreadsheet, and use conditional Formating from the Menu referencing to this field.

hope that helps,
If you have any questions, feel free to contact me


Related Discussions

Related Forums