So i've been searching how to divide text depending on its length but couldn't find anything.
My question is : In Excel using vba code, is it possible to divide a line of text into several lines in a single cell?
I don't have access to the text itself, it's inserted via a query from an Access Database. This being said, I can't really use the linebreak character "Chr(10)" to help me out.
I'm thinking of a way to distinguish if the text length is greater than a certain number of letters, it could be splited in 2 (or more actually) and then concatonate it using the linebreak character.
I hope my question/request is clear enough.
Thanks in advance.
If it's just for display purposes, then I think there is an easier method. You could set the column width to a width you like and format the cells in that column to Wrap Text.
There are two settings on your Querytable that you need to pay attention to. "Adjust column width" is unchecked by default and you need to check it. If you don't, Excel will make the column bigger and the fact that you have Wrap Text checked won't matter. "Preserve cell formatting" is checked by default and needs to remain checked. That will ensure that Wrap text stays checked for that column.
Setting the column width won't guarantee that you get a specific number of characters unless you use a fixed font. But if you just want to get close, this should work.