Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi. I'm trying to make a merged cell automatically resize vertically according to the number of lines of text I put into it. I found a piece of code that works but only when I add text. If I cancel all the text, the cell won't automatically shrink to one line height. To get this behaviour, I thought to use the following code in the "change" event section of the worksheet I'm working on: Code: -------------------- .... if target.value = "" then target.rows.autofit else (..... code that increase the row height accordingly to the numbers of text lines) end if .... -------------------- but, as soon as I hit the cancel key after selecting the cell, I get a VBA error: "not matching type" (not sure it's these words as I'm getting it in Italian: "tipo non corrispondente"). This "target.value" works OK if I'm putting text into the cell instead of canceling it. Can anybody help me, please? Also, please let me know if, when this all will be perfectly working (one day, I hope it will), anyone would be interested in the whole code. I'll be glad to share it and get the feedback. For me, this is a big lacking of in Excel formatting functions. I know there is that "Center in the colomns" but, what if I have to "Leften in the columns"? Thanks. -- fabiospark ------------------------------------------------------------------------ fabiospark's Profile: http://www.excelforum.com/member.php...o&userid=29327 View this thread: http://www.excelforum.com/showthread...hreadid=490526 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to set multiple columns in "If Target.Column =" | Excel Programming | |||
How to insert a "Target" line into basic bar chart | Charts and Charting in Excel | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
How to set multiple columns in "If Target.Column =" | Excel Programming | |||
SQL "INSERT INTO" Does not Modify Definition of Target Range | Excel Programming |