• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

conditional formatting

ljgent

New Member
Is there a formula that in selected cells once text, numbers are typed in that the cell is filled with a different color?


For example I choose cell A3 I type in a name the background fill changes to yellow.

Thanks in advance

ljgent
 
You have to use conditional formatting to achieve this. Select the Cell A3, go to conditional formatting (should be home ribbon or formatting menu). Specify a rule like if cell is not empty, and then select background color for the format.


See some examples here: http://chandoo.org/wp/2009/03/13/excel-conditional-formatting-basics/
 
ljgent

Try this macro which can be on a Module page so it will apply to all worksheets or

on a Worksheet Code page so that it only applies to the one sheet

Change color codes to suit


Private Sub Worksheet_Change(ByVal Target As Range)


Select Case True

Case IsEmpty(Target): Target.Interior.ColorIndex = xlNone: Target.Font.ColorIndex = 1 'Black

Case Application.IsText(Target): Target.Interior.ColorIndex = xlNone: Target.Font.ColorIndex = 5 ' Blue

Case Application.IsLogical(Target): Target.Interior.ColorIndex = xlNone: Target.Font.ColorIndex = 25 ' D.Blue

Case Application.IsErr(Target): Target.Interior.ColorIndex = xlNone: Target.Font.ColorIndex = 9 ' Brown

Case IsDate(Target): Target.Interior.ColorIndex = xlNone: Target.Font.ColorIndex = 4 ' Bright Green

Case InStr(1, Target.Text, ":") <> 0: Target.Interior.ColorIndex = xlNone: Target.Font.ColorIndex = 3 ' Red

Case IsNumeric(Target): Target.Interior.ColorIndex = xlNone: Target.Font.ColorIndex = 10 ' Green


End Select


End Sub
 
Back
Top