LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Trouble with "target.value" when cancelling...


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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set multiple columns in "If Target.Column =" Brad K. Excel Programming 4 April 28th 23 11:44 AM
How to insert a "Target" line into basic bar chart keith666 Charts and Charting in Excel 1 October 5th 08 08:00 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
How to set multiple columns in "If Target.Column =" KL[_5_] Excel Programming 0 December 24th 04 09:38 PM
SQL "INSERT INTO" Does not Modify Definition of Target Range No Name Excel Programming 0 February 27th 04 10:13 PM


All times are GMT +1. The time now is 03:47 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"