Automatic adjustment of Cell height?

T

Tristan

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
 
D

Dave Peterson

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
 
T

Tristan

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top