View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
eliano eliano is offline
external usenet poster
 
Posts: 25
Default In Excel, how can I show very long text in a single cell?

Hi Noreen.
Try to avoid excessive efforts :-)

'============= by Norman Jones in italian NG
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Rng As Range
Dim Rng2 As Range
Dim rCell As Range
Dim iPos As Long
Dim i As Long, j As Long
Dim iCtr As Long
Dim sStr As String
Const iNuovaRiga = 100 '<<=== to change

Set Rng = Range("A1:A100") '<<=== to change
Set Rng2 = Intersect(Rng, Target)

If Not Rng2 Is Nothing Then
On Error GoTo XIT
Application.EnableEvents = False
For Each rCell In Rng2.Cells
With rCell
rCell.Value = Replace(rCell.Value, Chr(10), "")
j = Len(.Text)
For i = 1 To j - iNuovaRiga Step iNuovaRiga
iPos = iNuovaRiga * (1 + iCtr) + iCtr
.Formula = Left(.Text, iPos) _
& Chr(10) & Mid(.Text, iPos + 1)
iCtr = iCtr + 1
Next i
End With
Next rCell
End If
XIT:
Application.EnableEvents = True
End Sub
'<<=============

Regards
Eliano


"Noreen" wrote:

I'm using WRAP TEXT but the data in the cell is truncated. I can see the
entire entry in the formula window, but not in the cell.