Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 510
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to make an Excel Cell contain text more than 31,737 Characters georgex Excel Discussion (Misc queries) 0 May 9th 07 03:39 AM
How do I creat a macro to delete the first 20 cell characters Bobo-ack Excel Worksheet Functions 5 April 20th 07 03:00 AM
set up a macro to delete characters in each cell of a column Rick Excel Discussion (Misc queries) 2 September 18th 05 03:02 AM
How do you make some characters in a cell bold and some not? tracman Excel Discussion (Misc queries) 4 March 28th 05 05:17 AM
Cell Truncates to 255 characters in Macro Andrew[_11_] Excel Programming 1 September 3rd 03 09:22 PM


All times are GMT +1. The time now is 10:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"