Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 413
Default Height + Width of a Range

What is the quickest way to return the overall width
(ie sum of columnwidths) and height (ie sum of
rowheights) for a range, please?

Regards.



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.719 / Virus Database: 475 - Release Date: 12/07/2004


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 340
Default Height + Width of a Range

Stuart, something like

rh=0
for each oRow in selection.rows
rh = rh + oRow.RowHeight
Next

I leave as an exercise the same code for column height!

Bob Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel


"Stuart" wrote in message
...
What is the quickest way to return the overall width
(ie sum of columnwidths) and height (ie sum of
rowheights) for a range, please?

Regards.



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.719 / Virus Database: 475 - Release Date: 12/07/2004




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Height + Width of a Range

this will give the overall column width of cols 1-12. Use rows(i).rowheight
for rows
Sub sumcolwidths()
For i = 1 To 12 Step 1
mcw = mcw + Columns(i).ColumnWidth
Next
MsgBox mcw
End Sub
====for the range
Sub sumcolWrowH()
With Range("a1:d5")
mr = .Rows.Count
For i = 1 To mr Step 1
mrh = mrh + Rows(i).RowHeight
Next
MsgBox "total row height =" & mrh
mc = .Columns.Count
For i = 1 To mc Step 1
mcw = mcw + Columns(i).ColumnWidth
Next
MsgBox "total col width =" & mcw
End With
End Sub
--
Don Guillett
SalesAid Software

"Stuart" wrote in message
...
What is the quickest way to return the overall width
(ie sum of columnwidths) and height (ie sum of
rowheights) for a range, please?

Regards.



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
http://www.grisoft.com).
Version: 6.0.719 / Virus Database: 475 - Release Date: 12/07/2004




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 413
Default Height + Width of a Range

Many thanks to you both.

Regards.

"Bob Flanagan" wrote in message
...
Stuart, something like

rh=0
for each oRow in selection.rows
rh = rh + oRow.RowHeight
Next

I leave as an exercise the same code for column height!

Bob Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel


"Stuart" wrote in message
...
What is the quickest way to return the overall width
(ie sum of columnwidths) and height (ie sum of
rowheights) for a range, please?

Regards.



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.719 / Virus Database: 475 - Release Date: 12/07/2004






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.719 / Virus Database: 475 - Release Date: 12/07/2004


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Height + Width of a Range

glad to help


--
Don Guillett
SalesAid Software

"Stuart" wrote in message
...
Many thanks to you both.

Regards.

"Bob Flanagan" wrote in message
...
Stuart, something like

rh=0
for each oRow in selection.rows
rh = rh + oRow.RowHeight
Next

I leave as an exercise the same code for column height!

Bob Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel


"Stuart" wrote in message
...
What is the quickest way to return the overall width
(ie sum of columnwidths) and height (ie sum of
rowheights) for a range, please?

Regards.



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.719 / Virus Database: 475 - Release Date: 12/07/2004






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.719 / Virus Database: 475 - Release Date: 12/07/2004






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Height + Width of a Range

Stuart,

I'm using Excel 2002, but I don't think it makes a difference.

Range("myRange").Width
Range("myRange").Height

Return the information you need.

Stan Scott
New York City

"Stuart" wrote in message
...
What is the quickest way to return the overall width
(ie sum of columnwidths) and height (ie sum of
rowheights) for a range, please?



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Height + Width of a Range

That does it for height better than what I sent but it is multiplying the
sum of the column widths by the height of the range. It is not giving the
sum of the column widths.

--
Don Guillett
SalesAid Software

"Stan Scott" wrote in message
...
Stuart,

I'm using Excel 2002, but I don't think it makes a difference.

Range("myRange").Width
Range("myRange").Height

Return the information you need.

Stan Scott
New York City

"Stuart" wrote in message
...
What is the quickest way to return the overall width
(ie sum of columnwidths) and height (ie sum of
rowheights) for a range, please?





  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Height + Width of a Range

Width used with a range, returns the width of the range in points. It
doesn't
multiplying the sum of the column widths by the height of the range.


--
Regards,
Tom Ogilvy


"Don Guillett" wrote in message
...
That does it for height better than what I sent but it is multiplying the
sum of the column widths by the height of the range. It is not giving the
sum of the column widths.

--
Don Guillett
SalesAid Software

"Stan Scott" wrote in message
...
Stuart,

I'm using Excel 2002, but I don't think it makes a difference.

Range("myRange").Width
Range("myRange").Height

Return the information you need.

Stan Scott
New York City

"Stuart" wrote in message
...
What is the quickest way to return the overall width
(ie sum of columnwidths) and height (ie sum of
rowheights) for a range, please?







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
columb width/height ohtml New Users to Excel 3 January 26th 10 05:43 PM
Row height/column width Connie Martin Excel Discussion (Misc queries) 3 June 20th 09 04:12 PM
Column Width and Row Height Workbook Excel Worksheet Functions 4 March 30th 09 06:46 AM
cell width and height Brian Brandt New Users to Excel 3 February 14th 06 10:57 AM
Setting width and height Tom Egan Excel Programming 0 February 5th 04 03:35 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"