Macro For Excel Text Limit & Conditional Formatting Formula

xstream

New Member
Joined
Dec 31, 2016
Messages
1
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.

Thank you :)
 

Some videos you may like

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Logit

Well-known Member
Joined
Aug 31, 2016
Messages
3,104
.
.
Code:
=LEN(E3)>6
...Change Cell reference and characters number as needed.
.

.
.
Untested :vba - Remove / overcome / exceed / overtake maximum characters limit of Excel cell - Stack Overflow
.

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>

<tbody>
</tbody>
 

Watch MrExcel Video

Forum statistics

Threads
1,095,956
Messages
5,447,551
Members
405,456
Latest member
melmelseh

This Week's Hot Topics

Top