Home » excel » Excel VBA cell character limit

Excel VBA cell character limit

Posted by: admin May 14, 2020 Leave a comment

Questions:

I am building a macro to export data from a custom outlook form to an excel workbook. The data will be extracted in the string format from user-defined fields in the outlook form. The string data will then be entered into the values of the excel cells. The strings may contain a huge number of characters.

I understand that each excel cell can hold 32,767 characters. What happens if I try to enter a string with more than 32,767 characters in an excel cell? What will happen to the excess characters?

I realize that the characters do not appear, but can these lost characters be recovered somehow?

How to&Answers:

They are simply lost and there is no way to recover them. You can test this out if you like:

Sub test()

Dim i As Long
Dim text As String

For i = 1 To 32767
    text = text & "a"
Next

text = text & "end"
Range("A1").Value = text
'"end" will be lost

End Sub