Excel VBA- format string length to get a cell height

  • Thread starter Thread starter lcoreyl
  • Start date Start date
L

lcoreyl

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
 
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.
 
lcoreyl > said:
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
 
Keith said:
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
 
Back
Top