PDA

View Full Version : Format line based on condition



Sir Babydum GBE
03-12-2012, 03:25 AM
Hi

How can I make the entire row bold if the date in column J matches today's date? (Date format in J is "ddd, dd mmm yy" if it's important)

I can't use conditional formatting because need formats to remain after condition has changed. (Basically the bold lines highlight the additions I make today, but the report I send may not be opened on the same day)

Many thx

BD

Bob Phillips
03-12-2012, 04:06 AM
Could you not make the CF dependent upon the date?

=J2=TODAY()

Sir Babydum GBE
03-13-2012, 01:31 AM
Could you not make the CF dependent upon the date?

=J2=TODAY()Is not possible Bob because...

At close of business I send a report with additions I made this day bolded to stand out. But the report isn't usually opened by the addressee on the same day, so the formatting would disappear before they opened it.

Bob Phillips
03-13-2012, 02:41 AM
Sorry, mis-read what you had written.

Do you want to bold the row when J changes and it is today, or whenever the value in J matches today's date?

Sir Babydum GBE
03-13-2012, 02:53 AM
Sorry, mis-read what you had written.

Do you want to bold the row when J changes and it is today, or whenever the value in J matches today's date?No worries.
Actually - I got it! (by research - not brains).

Sub BoldToday()
Dim i As Long
Dim MyNew As Long
Application.ScreenUpdating = False
LR = Cells(Rows.Count, 1).End(xlUp).Row
For i = MyNew To 2 Step -1
If Range("J" & i).Value = Date Then
Range("J" & i).EntireRow.Font.Bold = True
End If

Next i
Application.ScreenUpdating = True

End Sub