I would like to change the visual format of a range of cells based on the value I choose in a different cell.
Example: Based on the value entered in to cell B8 (an X or an 0), I would like a range of cells (F10;G14) to change the font color.
---------------------
Also, is there a way change the color of a font of a cell, if the value of that cell, is equal to the value in a range of cells?
try this code in sheet where you want to use this formatting
Best RegardsPrivate Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$B$8" Then Set Rng = Range("F10:G14") Select Case UCase(Target.Value) Case "X": Rng.Interior.ColorIndex = 3 Case 0: Rng.Interior.ColorIndex = 45 Case "": Rng.Interior.ColorIndex = none Case Else Rng.Interior.ColorIndex = none End Select End If End Sub
MaczaQ
Last edited by maczaq; 07-22-2011 at 04:37 PM. Reason: code update
You could do this with Conditional Formatting.
See the attached example workbook.
Regards
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks