开发者

weird issue in Excel sheet

I'm not able to import this one record to sql server 2000. It gives buffer limit exceeded. Why is it displaying characters like this? if i limit the characters开发者_运维问答 to 255 it's normal. I tried to simulate this like below.

Here is a sample file: http://sourcecodezone.com/test.xls

Open notepad. Create a small text within double quotes and paste in excel. Now double click that cell and add more characters so that it will cross 255. now you will see # symbols.

I tried changing the format to text. Now when you right click the cell and hit properties. it will show hashes again.

What property is this and how do i make it go back to normal? This record is just one example of millions of records i have to import.


In Excel 2003, you can have more than 255 characters in a cell but you can't set values or use the values from a cell that contains more than 255 cells.

You can use VBA to import your data that contains more than 255 characters by cell, something like:

Sub CutCell()
   Dim i as Integer
   Dim mytxt As String

   ' Create a string 1000 characters in length.
   mytxt = WorksheetFunction.Rept("test", 250)

   ActiveSheet.Shapes("Text Box 1").Select

   With Selection

      ' Initialize text in text box.
      .Text = ""
      For i = 0 To Int(Len(mytxt) / 255)
      .Characters(.Characters.Count + 1).Text = Mid(mytxt, (i * 255) + _
         1, 255)
      Next

   End With

End Sub

See microsoft documentation for more information about this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜