?
Solved

Excel, make a field bold if a condition is met

Posted on 2013-12-18
3
Medium Priority
?
368 Views
Last Modified: 2013-12-21
Hi,

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

    Next

    ActiveSheet.AutoFilterMode = False
    Application.ScreenUpdating = True

End Sub
0
Comment
Question by:c45
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 35

Accepted Solution

by:
[ fanpages ] earned 1500 total points
ID: 39728381
Hi,

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.

BFN,

fp.
Q-28321699.xls
0
 

Author Comment

by:c45
ID: 39732579
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.

thanks
helpq.xlsx
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 39733338
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.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question