Results 1 to 7 of 7
  1. #1
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Leuven, Vlaanderen, Belgium
    Posts
    322
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Conditional format: can't define text font (all?)

    Hey, members of the lounge,
    this isn't critical, but it should be nice...
    Does anyone know about certain conditions where you can't conditional format the text font in cells? In attachment a sample: I want to change the text font (e.g. 6 ipv 10) when a value is 0. The condition is properly defined and I can change a number of layout properties but NOT the font.
    TIA!!
    Hans

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Conditional format: can't define text font (all?)

    According to the dialog, you can only change the font style, underline, color and strikethrough. In other words, you cannot change the font name (Arial, Tahoma, ...) or font size (9, 10, 12, ...)

  3. #3
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Leuven, Vlaanderen, Belgium
    Posts
    322
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Re: Conditional format: can't define text font (all?)

    OK, Hans,
    thanks & sorry, I should have been a bit more careful before throwing out this post. You know, I really seemed to remember that once, in some spreadsheet, I had changed the font with conditional formatting too, so it seemed pretty weird that it wasn't possible here, without any apparent reason. In the meanwhile, I think I've found back the file where I thought I did it and... I've done it manually at that time <img src=/S/bash.gif border=0 alt=bash width=35 height=39>. So, it just really isn't possible at all, nowhere (checked it out in XP and it was the same over there... (Too bad, which makes me wonder though, by the way, to those wonder guys at Redmond: why not?)

    SORRY to have waisted your valuable time but thanks for making me realise my mistake. This saves me some useless searching time!

    Hasse

  4. #4
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Conditional format: can't define text font (all?)

    You can accomplish this using the Worksheet Change event routine:

    <pre>Private Sub Worksheet_Change(ByVal Target As Range)
    Dim ocell As Range
    If Not Intersect(Target, ActiveSheet.Range("B25")) Is Nothing Then
    For Each ocell In Intersect(Target, ActiveSheet.Range("B25"))
    If ocell.Value = 0 Then
    ocell.Font.Name = "Wingdings"
    Else
    ocell.Font.Name = "BAZOOKA"
    End If
    Next ocell
    End If
    End Sub
    </pre>

    Legare Coleman

  5. #5
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Leuven, Vlaanderen, Belgium
    Posts
    322
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Re: Conditional format: can't define text font (all?)

    Wow, now you made me dare using such Change event routine the first time (even though I know some VBA), as this seemed fun...
    I changed the "B25" in your example into the area on which I want to apply this high tech conditional formatting & customised the Font properties.
    And it works <img src=/S/bananas.gif border=0 alt=bananas width=33 height=35>!
    Now I'll probably ask some stupid VB-question but... as I always like to know what I'm doing: what is that 'Target' variable passed to this routine? Can I just leave it there in peace without needing it to do the job? What does it do? Is it the current cell?

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Conditional format: can't define text font (all?)

    The Worksheet_Change event occurs if one or more cells in the worksheet are changed by the user (or by an external link). The Target argument is the range of cells that have changed. Legare's code checks whether this range intersects with the cells you are interested in - if it doesn't, you don't want to do anything, and if it does, you want to format the cells in the intersection.

  7. #7
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Leuven, Vlaanderen, Belgium
    Posts
    322
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Re: Conditional format: can't define text font (all?)

    Thanks!

Posting Permissions

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