Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to set height of active cell? 1

Status
Not open for further replies.

larryww

Programmer
Mar 6, 2002
193
US
All of these stabs seem to fail with Run time error '424': Object required. May I please have the correct syntax? tyvm [peace]

ActiveCell.Height = 35

ActiveCell.Offset(0, 0).Height = 35

Set c = ActiveCell.Offset(0, 0)
c.Height = 35
 
You need the RowHeight property. Cells (rows) do not a height, it is reserved for shapes etc.

ActiveCell.RowHeight = 35 should do it for you.

AC
 
Thanks you two.

BTW, acron, they do seem to have a height:
when you type the period, the drop down choice of available {properties,methods} has height;
debug.print c.height does seem to give the height.

Ergo, I gather that it must be read-only.

Again, thanks for the correct solution.
 


Quoting from the Book of Help:

"For a single row, the value of the Height property is equal to the value of the RowHeight property. However, you can also use the Height property to return the total height of a range of cells.

Other differences between RowHeight and Height include the following:

Height is read-only.


If you return the RowHeight property of several rows, you will either get the row height of each of the rows (if all the rows are the same height) or Null (if they’re different heights). If you return the Height property of several rows, you will get the total height of all the rows."
 
Cells have a height - you are right. But read only because you can set the height of the cell independantly for the row(s) that it belongs to.

AC
 
k, ty eusk for taking the trouble and effort, and with useful purpose.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top