Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro for: If cell has 4 characters, make cell red
I'd like a macro to identify cells with only 4 characters (i.e. a yea like 1989) and if the cell has only 4 characters, to make th characters in the cell to the right of it bold red. For example, i cell A29 is 1933, the characters in cell B29 should be in bold red. Thanks for your help -- Sandema ----------------------------------------------------------------------- Sandeman's Profile: http://www.excelforum.com/member.php...fo&userid=3244 View this thread: http://www.excelforum.com/showthread.php?threadid=52530 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro for: If cell has 4 characters, make cell red
Hi Sandeman,
Give a try to following : Private Sub Worksheet_Change(ByVal Target As Range) Dim Cell As Range Set Target = Range("A1:A50") If Target Is Nothing Then Exit Sub Else For Each Cell In Target If Len(Cell.Value) = 4 Then Cell.Offset(0, 1).Range("A1").Interior.ColorIndex = 3 End If If Len(Cell.Value) < 4 Then Cell.Offset(0, 1).Range("A1").Interior.ColorIndex = xlNone End If Next Cell End If End Sub HTH Carim |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro for: If cell has 4 characters, make cell red
Wonderful. Thank you Carim -- Sandema ----------------------------------------------------------------------- Sandeman's Profile: http://www.excelforum.com/member.php...fo&userid=3244 View this thread: http://www.excelforum.com/showthread.php?threadid=52530 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to make an Excel Cell contain text more than 31,737 Characters | Excel Discussion (Misc queries) | |||
How do I creat a macro to delete the first 20 cell characters | Excel Worksheet Functions | |||
set up a macro to delete characters in each cell of a column | Excel Discussion (Misc queries) | |||
How do you make some characters in a cell bold and some not? | Excel Discussion (Misc queries) | |||
Cell Truncates to 255 characters in Macro | Excel Programming |