ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Height + Width of a Range (https://www.excelbanter.com/excel-programming/304322-height-width-range.html)

Stuart[_5_]

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



Bob Flanagan

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





Don Guillett[_4_]

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





Stuart[_5_]

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



Don Guillett[_4_]

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





Stan Scott

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?




Don Guillett[_4_]

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?






Tom Ogilvy

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?








Don Guillett[_4_]

Height + Width of a Range
 
I stand corrected. With the example I was using, it "seemed" to multiply.

--
Don Guillett
SalesAid Software

"Tom Ogilvy" wrote in message
...
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?










All times are GMT +1. The time now is 04:26 AM.

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