Keebellah
Board Regular
- Joined
- Feb 4, 2014
- Messages
- 115
Hi, in 2022 this post (Determine Point of Cell Word Wrap of A String (max length of string permitted for a static sized cell) ) more or less asks the same thing.
I have managed using a code snippet posted elsewhere that calculates the pixel width of a single character using the font name, size, bold true or false, italics true or false. For example a Z returns 6 for a PT Sans narrow bold 10.
Using the cell’s EntireColumn.Width which I assume gives me the column in pixels.
I am trying to calculate max number of characters I can pass to the cell to avoid word wrap.
The next step would be to calculate the number of characters across 5 columns and add a carriage return if the text length is longer than the 5 column widths added up
I do not like merged cells and would then place word wrap in the first cell and the other 4 will never contain text so it looks like a merged cell
Probably a confusing explanation but the gist of this all is that based on the single character’s pixel width calculated the max characters before a carriage return would be needed.
Creativity is in MHO the limit of VBA programming
I have managed using a code snippet posted elsewhere that calculates the pixel width of a single character using the font name, size, bold true or false, italics true or false. For example a Z returns 6 for a PT Sans narrow bold 10.
Using the cell’s EntireColumn.Width which I assume gives me the column in pixels.
I am trying to calculate max number of characters I can pass to the cell to avoid word wrap.
The next step would be to calculate the number of characters across 5 columns and add a carriage return if the text length is longer than the 5 column widths added up
I do not like merged cells and would then place word wrap in the first cell and the other 4 will never contain text so it looks like a merged cell
Probably a confusing explanation but the gist of this all is that based on the single character’s pixel width calculated the max characters before a carriage return would be needed.
Creativity is in MHO the limit of VBA programming