As excel has a 32,767 characters limit for per cell when applying wrap text. I am facing issue identifying the ones (out of tons of data) of which has exceeded the character limit.
Is there a Marco script that will allow the following to be done?
1) When cell text exceeded 32,767 characters, create new row below and merge the cells together. If still unable to display all characters in merge cell, then create a new row and merge them again until all characters (text) is displayed in that cell.
As for conditional formatting, what is the formula to highlight cells that is more than 32,767 characters.
Thanks to Darren (see comments above) the best and safest solution is to split the string into different cells.
The following code splits the string into parts with lenght < 32,000 characters. It add the parts to an array and then it writes the parts to the needed number of adjacent cells:
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: inherit;">iRow = ws.Cells(Rows.Count,1).End(xlUp).Offset(1,0).Row
col =1
' Get string from txtEncodedImage text input
sArray = SplitStr(txtEncodedImage.Value,32000)
For i = LBound(sArray)To UBound(sArray)
ws.Cells(iRow, col + i).Value = sArray(i) Next i
PublicFunction SplitStr(ByVal str AsString,ByVal numOfCharacters AsLong)AsString() Dim sArray()AsString Dim nCount AsLong Dim c AsLong
c = Len(str)\ numOfCharacters If c * numOfCharacters = Len(str)Then ReDim sArray(1To c) Else ReDim sArray(1To c +1) EndIf For c =1To Len(str)Step numOfCharacters
nCount = nCount +1
sArray(nCount)= Mid(str, c, numOfCharacters) Next
SplitStr = sArray EndFunction</code>
We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel
Which adblocker are you using?
Disable AdBlock
Follow these easy steps to disable AdBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the icon in the browser’s toolbar. 2)Click on the "Pause on this site" option.
Go back
Disable AdBlock Plus
Follow these easy steps to disable AdBlock Plus
1)Click on the icon in the browser’s toolbar. 2)Click on the toggle to disable it for "mrexcel.com".
Go back
Disable uBlock Origin
Follow these easy steps to disable uBlock Origin
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.
Go back
Disable uBlock
Follow these easy steps to disable uBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.