View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_5_] Dave Peterson[_5_] is offline
external usenet poster
 
Posts: 1,758
Default Excel VBA: Worksheet cell .Text property: 1024 bytes text len limit

This may illustrate loyso's problem:


Option Explicit
Sub testme()
Dim myCell As Range
Set myCell = ActiveSheet.Range("a1")
myCell.Formula = "=rept(""asdf "",500)"
With myCell
Debug.Print "Value length: " & Len(myCell.Value)
Debug.Print "Text Length: " & Len(myCell.Text)
End With
End Sub

Returned:

Value length: 2500
Text Length: 1024



Peter T wrote:

Is the cell a formula beginning with =. If so you can neither Read nor Write
a formula with length 1024 including the "=".

Otherwise, as I said previously a cell can contain text up to the 32K
character length limit, as my example routine demonstrated.

Regards,
Peter T

"loyso" wrote in message
...
Cells can contain text with length up to 32k. But a msgbox can only

display
1024 characters.


No! The problem isn't msgbox-related!
I see in integrated excel debugger that Len function returns 1024 for my
cell with 4k of text!

For Each ws In Worksheets
MsgBox Len(ws.Cells(1, 1).Text)
Next ws

Also displayes 1024 in message box.

Somebody - help me, please! :)


--
Alexei Baskakov



--

Dave Peterson