![]() |
macro for changing font color
-Hello,
What is the macro for changing the font color in a specific range based on the text entered? For instance, if user types in "Completed" into any cell in range B7:B175 the cell with completed should change the text color to green. I already have 3 allowable conditional formats in place so I need to write two more macros so I cover all 5 scenarios. Thanks, BearsFan |
macro for changing font color
'-----------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range) '----------------------------------------------------------------- Const WS_RANGE As String = "B7:B175" On Error GoTo ws_exit: Application.EnableEvents = False If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then With Target Select Case .Value Case "Completed": .Interior.ColorIndex = 10 'green 'etc. End Select End With End If ws_exit: Application.EnableEvents = True End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- HTH Bob Phillips (replace xxxx in the email address with gmail if mailing direct) "bearsfan" wrote in message ... -Hello, What is the macro for changing the font color in a specific range based on the text entered? For instance, if user types in "Completed" into any cell in range B7:B175 the cell with completed should change the text color to green. I already have 3 allowable conditional formats in place so I need to write two more macros so I cover all 5 scenarios. Thanks, BearsFan |
All times are GMT +1. The time now is 11:19 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com