Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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? |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
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? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
columb width/height | New Users to Excel | |||
Row height/column width | Excel Discussion (Misc queries) | |||
Column Width and Row Height | Excel Worksheet Functions | |||
cell width and height | New Users to Excel | |||
Setting width and height | Excel Programming |