TRaP
Moderator
Inregistrat: acum 7 ani
Postari: 811
|
|
For some reason I want to know the total width of 5 columns in a range. This could easily be calculated by summing up their widths manually, sure. But I might need to do this again. And again.
Find width of selected columns (letting VBA sum up each column's width):
Sub Find_Col_Widths()
Dim i As Integer Dim s As Double s = 0 For i = 1 To Selection.Columns.Count s = s + Selection.Columns(i).ColumnWidth Next i
MsgBox s
End Sub |
Find height of selected rows (letting VBA sum up each row's height):
Sub Find_Row_Height()
Dim i As Integer Dim s As Double s = 0 For i = 1 To Selection.Rows.Count s = s + Selection.Rows(i).RowHeight Next i
MsgBox s
End Sub |
|
|