ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automatic adjustment of Cell height? (https://www.excelbanter.com/excel-programming/387372-automatic-adjustment-cell-height.html)

Tristan[_13_]

Automatic adjustment of Cell height?
 
Hi,

I'm using automation to start Excel and fill some columns with data. Once
of the columns has quite a bit of text in some of the cells while some only
have few lines.

I've set TextWrap=.t. for each Cell, but it doesn't adjust the height. Is
there an excel property that I can call to do this automatcially, or some
other way of working out how high each cell should be sized.

Thanks



Dave Peterson

Automatic adjustment of Cell height?
 
If I were doing it in excel, I'd use something like:

activesheet.rows(35).autofit
(to set a specific row)

or
activesheet.rows.autofit
(to do all of them)

or
activesheet.range("a1:A99").entirerow.autofit
(to get a range of rows




Tristan wrote:

Hi,

I'm using automation to start Excel and fill some columns with data. Once
of the columns has quite a bit of text in some of the cells while some only
have few lines.

I've set TextWrap=.t. for each Cell, but it doesn't adjust the height. Is
there an excel property that I can call to do this automatcially, or some
other way of working out how high each cell should be sized.

Thanks


--

Dave Peterson

Tristan[_13_]

Automatic adjustment of Cell height?
 
This is my code:

SELECT QResults
SCAN
WITH oRange
..Columns[1].Value=QResults.wrkovertm
..Columns[2].Value=QResults.wrkdate
..Columns[3].Value=QResults.wrkbilling
..Columns[4].Value=ALLTRIM(QResults.wrkdesc)
..Columns[4].WrapText = .T.
..Columns[4].VerticalAlignment = -4160
..Columns[4].autofit
..Columns[5].Value=QResults.staffnm
Endwith


* Move range down one row
oRange = oRange.Offset(1,0)


Endscan

I added the autofit in the above code, and all it did was make each cell
exactly the same size. So if there is 2 lines of text in them, the hight
has been made so large that it shows about 10 more lines of extra white
space underneath the text.

Maybe I didn't do it right?

Thanks for your help



"Dave Peterson" wrote in message
...
If I were doing it in excel, I'd use something like:

activesheet.rows(35).autofit
(to set a specific row)

or
activesheet.rows.autofit
(to do all of them)

or
activesheet.range("a1:A99").entirerow.autofit
(to get a range of rows




Tristan wrote:

Hi,

I'm using automation to start Excel and fill some columns with data.
Once
of the columns has quite a bit of text in some of the cells while some
only
have few lines.

I've set TextWrap=.t. for each Cell, but it doesn't adjust the height.
Is
there an excel property that I can call to do this automatcially, or some
other way of working out how high each cell should be sized.

Thanks


--

Dave Peterson





All times are GMT +1. The time now is 10:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com