Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default autosize cells

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default autosize cells

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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default autosize cells

thanks, works perfect!

Reply
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
ComboBox autosize GIP Excel Worksheet Functions 0 August 21st 10 04:50 PM
Autosize cells as data is entered Carol Excel Discussion (Misc queries) 16 April 4th 10 08:14 PM
Autosize Error willemeulen Excel Discussion (Misc queries) 0 February 25th 10 12:17 PM
Autosize merged cells Teri Excel Discussion (Misc queries) 7 March 6th 08 05:59 PM
autosize Learning the hard way Excel Programming 2 May 25th 06 02:16 PM


All times are GMT +1. The time now is 11:15 PM.

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"