Results 1 to 5 of 5
  1. #1
    Star Lounger
    Join Date
    Nov 2001
    Location
    Houston, Texas
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Conditional Formatting (2000/SR-1)

    I would like to set up a conditional format for cell A1 based on whether cell B1 is bold. I believe that I need to use a formula and external cell reference, but I don't know how to set up my formula to check for bold in B1. Can anyone help?

    Thanks,
    Caroline

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Conditional Formatting (2000/SR-1)

    You have to create a user-defined function to see if the cell is bold. Excel has no Built-in "isbold" function. this one will look in the upperleft cell of a range.

    <pre>Function IsBold(rng As Range) As Boolean
    IsBold = rng.cells(1).Font.Bold
    End Function
    </pre>


    Then in Cond Formatting, use the formula:
    =isbold(b1)

    Steve

  3. #3
    Star Lounger
    Join Date
    Nov 2001
    Location
    Houston, Texas
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Conditional Formatting (2000/SR-1)

    Thanks for the very quick response, Steve. My next question is how do I create a user-defined function? I know how to create a macro - is this just a macro?

    Thanks again,
    Caroline

  4. #4
    Star Lounger
    Join Date
    Nov 2001
    Location
    Houston, Texas
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Conditional Formatting (2000/SR-1)

    Upon some digging, I have figured out how to create the user-defined function and it works. As written, it applies to the upper-most cell in a range. However, I want to modify it so that it will check for any bolded cell in a range. The range will actually be one row, 6 columns across. What do I need to do to effect this change?

    Thanks,
    Caroline

  5. #5
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Conditional Formatting (2000/SR-1)

    This will give true if ANY of the cells referenced are Bold.

    Use: =isbold(A1:A10)

    Steve

    <pre>Option Explicit
    Function IsBold(rng As Range) As Boolean
    Dim rCell As Range
    IsBold = False
    For Each rCell In rng
    If rCell.Font.Bold Then
    IsBold = True
    Exit Function
    End If
    Next rCell
    End Function</pre>


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •