View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
DataFreakFromUtah DataFreakFromUtah is offline
external usenet poster
 
Posts: 36
Default Return Row Heights for Rows in Active Worksheet - an example

Hello,
No question here, just a procedure for the archive.

Search criteria: return row heights for all rows in active
worksheet get row heights get row height report row width report row
height
examine list row heights find all row heights all row height
row's heights row's height rows' height rows' heights

Note: this procedure only seems to return the row heights for row
numbers 1-32765.
After this row, the report just jumps to row number 65536 and the
row's corresponding height. I'm using Excel 2000 on Win 2000 Pro.
The procedure seems to want to deliver row heights for just the first
"half" of the rows in the target (active) worksheet. Oh well. If
anyone has any thoughts, please do tell. :)


Sub RowHeightReport()

'Creates a new report worksheet that returns the each row number
'and each row's height in the active worksheet.
Dim cell As Range
Dim RowHeightReportSheet As Worksheet
Dim TargetWorksheet As Worksheet
Dim R As Range
Dim RowHeight As Variant
Dim Row As Integer

On Error Resume Next

'Add a new worksheet
Application.ScreenUpdating = False
Set TargetWorksheet = ActiveWorkbook.ActiveSheet
Set RowHeightReportSheet = ActiveWorkbook.Worksheets.Add
RowHeightReportSheet.Name = "RowHeights in " &
TargetWorksheet.Name

RowHeight = 1

'Set up the column headings for Report worksheet

Range("A1") = "Row Number"
Range("B1") = "Row Height"
Range("A1:B1").Font.Bold = True


'Process each column
Row = 2
For Each R In TargetWorksheet.Rows
'Derive row height of the row
RowHeight = R.RowHeight

With RowHeightReportSheet

Cells(Row, 1).Value = R.Row
Cells(Row, 2).Value = RowHeight
Row = Row + 1

End With

Next

'Adjust column widths on Report sheet
RowHeightReportSheet.Columns("A:B").AutoFit
RowHeightReportSheet.Columns("A:B").HorizontalAlig nment = xlCenter
Application.StatusBar = False

'Select a cell on the top of the report worksheet
Range("A2").Select

End Sub