Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you determine if text in merged cells is being cut off 1

Status
Not open for further replies.

Stoffel24

Technical User
Apr 4, 2002
121
ZA
I have a spreadsheet where the title is merged across several columns. In my subroutine, I choose to autofit columns. However, this doesn't take into account the title and so in cases where the number of columns is small, the title is truncated. Is there a way to determine if the title is being truncated so that I don't have to have a loop determining the combined widths of all the columns and then doing a second loop to widen the columns if the combined width is too narrow for the title? (WHEW!!)

If you have other ideas as to how I could achieve my objective, I'm all ears! [bigears]
 
You don't need a loop to tally up the column widths - the following expression:

columns("B:K").width

gives you the combined width. Still, your question is an interesting one, that I've yet to hear a real straightforward answer to. What I usually do in this situation is copy (temporarily) the merged cell contents to a normal cell in a column somewhere out of the way (say, column AA), do an autofit on that column to determine the width of the cell contents, and compare that to the merged cell width. If it doesn't fit, it's up to you to decide how to make it fit...
Rob
[flowerface]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top