Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Excel, make a field bold if a condition is met

Posted on 2013-12-18
3
Medium Priority
?
376 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
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…

636 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