Solved

Excel, make a field bold if a condition is met

Posted on 2013-12-18
3
306 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
  • 2
3 Comments
 
LVL 35

Accepted Solution

by:
[ fanpages ] earned 500 total points
Comment Utility
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
Comment Utility
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 ]
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

763 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

Need Help in Real-Time?

Connect with top rated Experts

5 Experts available now in Live!

Get 1:1 Help Now