View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
M John M John is offline
external usenet poster
 
Posts: 35
Default incorrect displaying of "alt-enter"

Sébastien,

Thank you for all your help thus far. My latest difficulty is how to make
the code below work for any selected cell.....not just data in the e1:e500
range? Is there a way to make this code work for any/all cells currently
selected?
Thanks again. You've been an enormous help.

M John


Dim rg As Range, cell As Range
Dim txtpos As Long, txtlen As Long

Set rg = Range("E1:E500")
For Each cell In rg.Cells
txtpos = 1
txtlen = Len(cell.Offset(0, -3).Text) 'length of text in A
cell.Characters(1, txtlen).Font.ColorIndex = 3 'color in red
txtpos = txtpos + txtlen + 1 ' +1 for the newline character
txtlen = Len(cell.Offset(0, -2).Text) 'length of text in B
cell.Characters(txtpos, txtlen).Font.ColorIndex = 5 'search for blue,
i don't know
txtpos = txtpos + txtlen + 1 ' +1 for the newline character
txtlen = Len(cell.Offset(0, -1).Text) 'length of text in C
cell.Characters(txtpos, txtlen).Font.ColorIndex = 10 'search for
green, i don't know
txtpos = txtpos + txtlen + 1
cell.WrapText = True
Next