Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
sum height of selected rows
Is there an easy way to calculate the total height of selected rows?
eg, when I select 30 rows, where some or all of them have different heights, how can I calculate the total height of the selection? Even better, is there a VBA script for this? Excel 2007 Thanks -- Please, remove hyphens to contact me -- |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
sum height of selected rows
On Sun, 18 Jan 2009 06:27:00 -0800, geotso
wrote: Is there an easy way to calculate the total height of selected rows? eg, when I select 30 rows, where some or all of them have different heights, how can I calculate the total height of the selection? Even better, is there a VBA script for this? Excel 2007 Thanks -- Please, remove hyphens to contact me If your selection is contiguous, i.e. without any gaps, you may try this macro: Sub height_of_selected_rows() h = 0 For i = Selection.Row To Selection.Row + Selection.Rows.Count - 1 h = h + Cells(i, 1).height Next i MsgBox "The sum of heights of the selected rows is " & h End Sub Hope this helps / Lars-Åke |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
sum height of selected rows
Hi,
You do do this For Each c In Selection TotHeight = TotHeight + c.RowHeight Next MsgBox TotHeight Mike "geotso" wrote: Is there an easy way to calculate the total height of selected rows? eg, when I select 30 rows, where some or all of them have different heights, how can I calculate the total height of the selection? Even better, is there a VBA script for this? Excel 2007 Thanks -- Please, remove hyphens to contact me -- |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
sum height of selected rows
I don't think that we can assume that the selection is limited to one
column, especially as the OP writes that "30 rows" are selected. Lars-Åke On Sun, 18 Jan 2009 06:48:02 -0800, Mike H wrote: Hi, You do do this For Each c In Selection TotHeight = TotHeight + c.RowHeight Next MsgBox TotHeight Mike "geotso" wrote: Is there an easy way to calculate the total height of selected rows? eg, when I select 30 rows, where some or all of them have different heights, how can I calculate the total height of the selection? Even better, is there a VBA script for this? Excel 2007 Thanks -- Please, remove hyphens to contact me -- |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
sum height of selected rows
"Mike H" wrote:
Hi, You do do this For Each c In Selection TotHeight = TotHeight + c.RowHeight Next MsgBox TotHeight Mike I get a message "12779520" for my selection (an example of 32 rows). What does that mean? Thanks |
#6
Posted to microsoft.public.excel.misc
|
|||
|
|||
sum height of selected rows
"Lars-Ã…ke Aspelin" wrote:
If your selection is contiguous, i.e. without any gaps, you may try this macro: Sub height_of_selected_rows() h = 0 For i = Selection.Row To Selection.Row + Selection.Rows.Count - 1 h = h + Cells(i, 1).height Next i MsgBox "The sum of heights of the selected rows is " & h End Sub Hope this helps / Lars-Ã…ke I've tried it and works like a charm! Thank you very much |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Color alternate rows when after hiding selected rows | Excel Worksheet Functions | |||
How to create different height rows in different columns | Setting up and Configuration of Excel | |||
hidden/0 height rows | Excel Discussion (Misc queries) | |||
HOW DO YOU FIX A ROWS HEIGHT | Excel Discussion (Misc queries) | |||
Rows don't print at full height. | Excel Discussion (Misc queries) |