PC Review


Reply
Thread Tools Rate Thread

autosize cells

 
 
bernd
Guest
Posts: n/a
 
      21st Aug 2007
Hello,

I've a worksheet with cells that are filled with a Hlookup function.
The problem is that sometimes the data in one cell is just one word
but other times 1000 words.

Is it possible to add a propery to the cell so that they are adjusted
to fit the content best? (I wan't them to be adjusted vertically)

Thanks,

Bernd

 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      21st Aug 2007
Maybe you can tie into that worksheet's calculation event to resize the rows.

If you want to try, right click on the worksheet that should have this
behavior. Select View code. Paste this into the code window:

Option Explicit
Private Sub Worksheet_Calculate()
application.enableevents = false
Me.Rows.AutoFit
'or be specific
Me.Rows("1:33").AutoFit
application.enableevents = true
End Sub

Changing the rowheight in some versions of excel (xl2003+, IIRC) will cause the
excel to want to recalc again. The .enableevents stuff stops excel from going
into a loop--recalc, loop, recalc, loop, ....

bernd wrote:
>
> Hello,
>
> I've a worksheet with cells that are filled with a Hlookup function.
> The problem is that sometimes the data in one cell is just one word
> but other times 1000 words.
>
> Is it possible to add a propery to the cell so that they are adjusted
> to fit the content best? (I wan't them to be adjusted vertically)
>
> Thanks,
>
> Bernd


--

Dave Peterson
 
Reply With Quote
 
bernd
Guest
Posts: n/a
 
      22nd Aug 2007
thanks, works perfect!

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Autosize cells as data is entered =?Utf-8?B?Q2Fyb2w=?= Microsoft Excel Misc 16 4th Apr 2010 08:14 PM
Autosize merged cells Teri Microsoft Excel Misc 7 6th Mar 2008 05:59 PM
Can Excel autosize merged cells yet? baobob@my-deja.com Microsoft Excel Discussion 1 8th Jan 2008 01:48 PM
autosize =?Utf-8?B?ODVhc2NNY0xhcmVu?= Microsoft Access VBA Modules 0 23rd Aug 2007 02:10 PM
Re: AutoSize Larry Linson Microsoft Access Reports 0 12th Aug 2003 08:23 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:53 PM.