PDA

View Full Version : [SOLVED] Length of text within cells



mdmackillop
03-23-2005, 01:02 PM
Is there a method of calculationg the length of a string of text in relation to a cell?
My workbook setup does not allow me to autofit rows, as it would upset printer output. I would like then, having typed in a string of text, that the length is split into suitable lengths, additional rows inserted to suit, and the text written in the appropriate cells.
I've done this before based on a set number of characters, looking for the previous space and so on, which works tolerably well, but is not very flexible. Any suggestions for a better approach?

Zack Barresse
03-23-2005, 01:05 PM
MD,

The closest I think one can come to that would be expressed by Suat's recent entry to Aaron Blood's Challenge ... http://www.xl-logic.com/xl_files/challenge/adv_range_detection.zip

Other than that, I'm not sure that there's a decent way to do this. Maybe checking pixel length using API..??

Paleo
03-23-2005, 01:15 PM
Hi MD,

maybe you could use this:



Range("A1:IV65536").WrapText = True

mdmackillop
03-23-2005, 01:23 PM
Hi Carlos,
I have to insert a footer/header every 45 rows when the document is printed with "Carry Forwards" etc, page numbering etc. If I wrap text, I'll need to start finding page lengths etc, which is a route I wish to avoid.

Paleo
03-23-2005, 01:28 PM
Oh ok, well than the only thing I can imagine is to follow Zacks suggestion.

mdmackillop
03-23-2005, 05:41 PM
Thanks Zack,

I've had a look at that, but it doesn't look like the way forward, but here's my solution to Aaron's problem (I've done a KB with it too)

Zip file revised; options added.

Paleo
03-23-2005, 05:53 PM
Great Malcolm,


I will save it, who knows when I may need it.:thumb

mdmackillop
03-25-2005, 12:08 PM
Update