Excel User Group
Microsoft Excel blogs, forums, files. Read, ask questions, provide answers.

Inputs color coded Blue

Latest post Tue, Jun 30 2009 6:15 PM by Jim Cone. 10 replies.
  • Mon, Jun 29 2009 3:19 PM

    • Tami
    • Top 150 Contributor
    • Joined on Mon, Jun 29 2009
    • Posts 5
    • Points 105

    Inputs color coded Blue

    I have a model and i want the whole thing to be in black font, except for any cells that are values...the cells that have values should be blue.

    how do i do this?

    • Post Points: 21
  • Mon, Jun 29 2009 10:08 PM In reply to

    • Jim Cone
    • Top 10 Contributor
    • Joined on Tue, Jan 15 2008
    • Portland, Oregon - USA
    • Posts 84
    • Points 1,269

    Re: Inputs color coded Blue


    More information is needed.

    Cells with anything in them are said to have a value so...
    How do you define a value?...
    Numbers, Text, Formulas or something else?

    What version of Excel?
    '--
    Jim Cone
    Portland, Oregon USA

    • Post Points: 21
  • Tue, Jun 30 2009 10:40 AM In reply to

    • Tami
    • Top 150 Contributor
    • Joined on Mon, Jun 29 2009
    • Posts 5
    • Points 105

    Re: Inputs color coded Blue

    Hi Jim, thanks for responding.

    I would say anything with Text or a Number is a value.

    Microsoft XP...is that enough info or do i need a year or number?

     

    • Post Points: 21
  • Tue, Jun 30 2009 11:33 AM In reply to

    • Jim Cone
    • Top 10 Contributor
    • Joined on Tue, Jan 15 2008
    • Portland, Oregon - USA
    • Posts 84
    • Points 1,269

    Re: Inputs color coded Blue

     

    I assume you mean Office XP (also known as Office 2002).
    Go to the Help menu and click About to see the Office version.

    Cell content is pretty much made up of either text or numbers.
    So I am confused as to which cells you mean.
    You should be able to select the cells you want to change and then specify a blue
    font color using the toolbar button that looks like an A with a colored bar underneath it.

    Also take a look at the "Special Cells" option found under Edit (menu) | Go To | Special (button)
    '--
    Jim Cone
    Portland, Oregon USA

    • Post Points: 21
  • Tue, Jun 30 2009 11:48 AM In reply to

    • Tami
    • Top 150 Contributor
    • Joined on Mon, Jun 29 2009
    • Posts 5
    • Points 105

    Re: Inputs color coded Blue

    I'm so sorry, i'm not being very clear.

    I have a model with a ton of forumulas and many users.  should they choose to type over one of my formulas, (i want them to be able to), but i want the font to change blue so its very apparent that the formula has been typed over.

    • Post Points: 21
  • Tue, Jun 30 2009 1:03 PM In reply to

    • Jim Cone
    • Top 10 Contributor
    • Joined on Tue, Jan 15 2008
    • Portland, Oregon - USA
    • Posts 84
    • Points 1,269

    Re: Inputs color coded Blue

    OK, we are on the same page now.
    It will require some VBA event code to accomplish that.
    Is that an acceptable option?
    '--
    Jim Cone

    • Post Points: 5
  • Tue, Jun 30 2009 1:37 PM In reply to

    • Jim Cone
    • Top 10 Contributor
    • Joined on Tue, Jan 15 2008
    • Portland, Oregon - USA
    • Posts 84
    • Points 1,269

    Re: Inputs color coded Blue


    Well you didn't ask for it, but<g> ...

    Goes in a standard/regular module:
    '--
    Public FormulaCount As Long

    Sub ResetInteriorAndFontColors()
    Dim rCell As Range
    For Each rCell In Application.Intersect(Selection, ActiveSheet.UsedRange).Cells
        If rCell.Interior.Color = vbBlue Then
           rCell.Interior.ColorIndex = xlColorIndexNone
           rCell.Font.ColorIndex = xlColorIndexAutomatic
        End If
    Next
    End Sub
    '--

    Goes in the "ThisWorkbook" module:
    '--
    Private Sub Workbook_Open()
    FormulaCount = ThisWorkbook.Worksheets("Sheet1").Cells.SpecialCells(xlCellTypeFormulas).Count
    End Sub
    '--

    Goes in the worksheet module of the sheet with the formulas:
    '--
    Private Sub Worksheet_Change(ByVal Target As Range)
    On Error GoTo BadChange
    Application.EnableEvents = False
    If FormulaCount > Me.Cells.SpecialCells(xlCellTypeFormulas).Count Then
       Target.Interior.Color = vbBlue
       Target.Font.Color = vbYellow
    End If
    FormulaCount = Me.Cells.SpecialCells(xlCellTypeFormulas).Count
    BadChange:
    Application.EnableEvents = True
    End Sub
    '--

    Note:  Change all references to "Sheet1" to the actual sheet name.
    --
    Jim Cone

    • Post Points: 21
  • Tue, Jun 30 2009 1:49 PM In reply to

    • Tami
    • Top 150 Contributor
    • Joined on Mon, Jun 29 2009
    • Posts 5
    • Points 105

    Re: Inputs color coded Blue

    wow...ok, i know a little about modules so i might be able to put them where they belong, but do you have to run them?

    • Post Points: 21
  • Tue, Jun 30 2009 2:24 PM In reply to

    • Jim Cone
    • Top 10 Contributor
    • Joined on Tue, Jan 15 2008
    • Portland, Oregon - USA
    • Posts 84
    • Points 1,269

    Re: Inputs color coded Blue

    Yes and No.
    The cell coloring is done automatically when any formula is changed on the sheet.
    The code changes the cell background to Blue and the Font to Yellow.
    I choose that, because if a formula was deleted (not over written) then you could not see Blue font.

    However, the workbook, after the code is added, will have to be saved and then closed and reopened.
    That is required in order for the count of formulas to be established.
    (or you could just run the "ThisWorkbook" code)

    The "reset" code in the regular module is there for your convenience.
    To use it just make a selection and run the code from Tools | Macro | Macros.
    Just those cells with a blue background will be reset to normal colors.

    Note:  The posted code may be word wrapped by this website.
    If so, it will require some "unwordwrapping" before it will function.
    '--
    Jim Cone

    • Post Points: 21
  • Tue, Jun 30 2009 2:36 PM In reply to

    • Tami
    • Top 150 Contributor
    • Joined on Mon, Jun 29 2009
    • Posts 5
    • Points 105

    Re: Inputs color coded Blue

    ok, i'm going to try this but its a little "above my head".  no chance of using conditional formatting?...like asking if its a formula then black font...if not a formula blue font?

    • Post Points: 21
  • Tue, Jun 30 2009 6:15 PM In reply to

    • Jim Cone
    • Top 10 Contributor
    • Joined on Tue, Jan 15 2008
    • Portland, Oregon - USA
    • Posts 84
    • Points 1,269

    Re: Inputs color coded Blue

     
    The following is from a post by Jim Rech from seven years ago.
    It worked for me.

    Begin Quote...
    "The other way that comes to mind is the old Excel 4 macro defined name technique.
    You create a name like IsFormula with the definition

    =LEFT(GET.CELL(6,A1),1)="="

    where A1 is the active cell when you create the name.  
    Then your condition is just =IsFormula.
    I'm not saying this is better than a UDF though.  Just an alternative."
    ...End Quote

    '--
    Jim Cone

    • Post Points: 5
Page 1 of 1 (11 items) | RSS
Copyright Excel User Group and the relevant contributors, 2009. All Trade Marks acknowledged. This site is a peer-to-peer site and NOT affiliated in any way to Microsoft Corp. All rights reserved.