ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel VBA- format string length to get a cell height (https://www.excelbanter.com/excel-programming/291134-excel-vba-format-string-length-get-cell-height.html)

lcoreyl[_9_]

Excel VBA- format string length to get a cell height
 
I have a database where some cells are taking almost half the page. Th
cells are all text. I would like to write some code that will go thr
and chop down cells over a certain height into multiple cells.

I was trying to find a relationship between the number of character
and the height, but some of these cells have multiple line breaks i
them.

Also, I would like to find a way for the code to cut in at intelligen
places if possible.

any ideas

--
Message posted from http://www.ExcelForum.com


Rob van Gelder[_4_]

Excel VBA- format string length to get a cell height
 
You could iterate on a cell, splitting it until your RowHeight is at the
desired size.
Use Rows(x).EntireRow.AutoFit to get your cell fitting the text nicely in
each iteration.

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"lcoreyl " wrote in message
...
I have a database where some cells are taking almost half the page. The
cells are all text. I would like to write some code that will go thru
and chop down cells over a certain height into multiple cells.

I was trying to find a relationship between the number of characters
and the height, but some of these cells have multiple line breaks in
them.

Also, I would like to find a way for the code to cut in at intelligent
places if possible.

any ideas?


---
Message posted from http://www.ExcelForum.com/




lcoreyl[_10_]

Excel VBA- format string length to get a cell height
 
Is there a way to trim a text string at "smart" places like a period o
line break

--
Message posted from http://www.ExcelForum.com


Keith Willshaw

Excel VBA- format string length to get a cell height
 

"lcoreyl " wrote in message
...
Is there a way to trim a text string at "smart" places like a period or
line break?


Use the instr function to find the location of the period and then mid to
trim it

You could write your own function using these to do your smart trim

Keith



lcoreyl[_11_]

Excel VBA- format string length to get a cell height
 
Keith Willshaw wrote:

Use the instr function to find the location of the period and the
mid to
trim it
Keith [/b]


Yes!!! Thanks!! That's what I was looking for! I searched around in V
help looking for something like instr but never found it

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 12:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com