Excel, make a field bold if a condition is met


Do I have to write some VB in a macro to accomplish the following ? and if so am I along the right lines of thinking here.

1) Range l3-l17 has times in it.  
2) I need to get the earliest time so a (Min function)
3) Then in the Range b3-j17 i have various times in each cell

If any of the times in the b3-j17 range is >= the min value in Range i3-i17 the value in that cell needs to be bold.

so from research I came up with this..

a) is it correct
b) where do i place it in excel macros. ?

Sub BoldHours()

    Application.ScreenUpdating = False
    Dim c As Long

    For Each c = 2 to 10 ' this covers column b to J

        ActiveSheet.AutoFilterMode = False

        With Range("b3:j17").Offset(0, c - 1)

            .Font.Bold = False
            .AutoFilter Field:=1, Criteria1:=">=min( l3:l17)"
            .Font.Bold = True
        End With


    ActiveSheet.AutoFilterMode = False
    Application.ScreenUpdating = True

End Sub
Who is Participating?
[ fanpages ]Connect With a Mentor IT Services ConsultantCommented:

Do I have to write some VB in a macro to accomplish the following

No, you do not need Visual Basic for Applications code (within a macro) to accomplish this.

You could use Conditional Formatting, for example:
Conditional Formatting applied
However, are you sure you wish to set every cell to Bold that is greater than, or equal to, the minimum time value in that range?

If every cell has a time value within it, then every cell will be greater than, or equal to, the minimum value.  Every cell will be Bold!

In case this is not what you wanted, I have attached a workbook that just sets every cell that is greater than the minimum time value to Bold.  The cell that is equal to the minimum value is not set to Bold.

If you did want every cell to be Bold that matches the condition, then simply change the greater than sign (>) to greater than, or equal to (>=) in the Conditional Formatting Condition.


c45Author Commented:
Hi, Thanks,

I mis spoke, The Min Value has to be from a range in another cell group.

See attached.

I wish to examine the cells B1-j15 and see if any of the times are greater than the earliest time in cells l1:l15

if they are they need to be bold or change color.

I have changed the colors of the cells manually to show what the correct ones should be.

[ fanpages ]IT Services ConsultantCommented:
You have closed the question (grading as a 'B') without allowing me time to respond.

I am sorry I was not able to return to reply immediately upon your re-evaluation of your requirements, but I am now presuming you no longer wish to receive any assistance.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.