retrieving excel row height
VB6
have an excel sheet open, all works well.
I want to retrieve the height of a row and i cant seem to find any function to do it
more precisely i want to do something like
VB Code:
For i = 1 To range.rows.count
Msgbox worksheet.row(i).height
Next i
only problem is worksheet.row doesnt have an index or any properties... nor does anything else i have been able to find.
Thanks
Re: retrieving excel row height
Its based upon a Range object.
VB Code:
With Worksheets("Sheet1").Rows(1)
MsgBox .RowHeight
End With
:)
Re: retrieving excel row height
RobDog888 is right, it's based on the Range object.
The object browser is your best friend when it comes to stuff like this. If you have the referenced checked for excel in your VB project, then you can press F2 to view the object browser. You'll see a combo box that says "<All Libraries>". Select "Excel" from the combo box to see all the classes of Excel. In the classes listbox select "Range" and in the "Members of 'class' " listbox you'll see all the Range's properties, methods, collections, etc. You'll find RowHeight in there. Much easier to navigate in there rather than Intellisense.
:thumb:
Re: retrieving excel row height
Quote:
more precisely i want to do something like
visual basic code:--------------------------------------------------------------------------------
For i = 1 To range.rows.count
Msgbox worksheet.row(i).height
Next i
Hi
To find rowheight of all the rows in the range use Rob's code in your loop i.e
VB Code:
For i = 1 To range.rows.count
With Worksheets("Sheet1").Rows(i)
MsgBox .RowHeight
End With
Next i
Hope this helps...
Re: retrieving excel row height
well actually this issue is resolved now but not by using the .rowheight property
in excel you can resize rows, so some rows might be different heights than others. as far as i can see .RowHeight returns the average or the default row height.
to get it to work i used some command like row(i).height... but im not on the same computer i coded it in... i'll post my code later
Re: retrieving excel row height
No it doesn't. Rowheight returns the height of the row corresponding to the range you passed. If you pass it a single row, then it will return the height of that row.
But at least it is working now.
zaza