Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Return Row Heights for Rows in Active Worksheet - an example
Hi DataFreak,
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. :) This is because you declare your variable row as integer - try changing to long. --- Regards, Norman |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Return Row Heights for Rows in Active Worksheet - an example
If you use up one row to put in headers, how are you going to report on the
total number of rows. Also, if you can't figure out why your code is flawed, why do you want to archive it? Using ON Error Resume Next at the top of your code is a good indicator that your code is flawed. -- Regards, Tom Ogilvy "DataFreakFromUtah" wrote in message om... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Different cell heights within worksheet | New Users to Excel | |||
Copy Value of Active cell and 25 rows above to a diff worksheet | Excel Discussion (Misc queries) | |||
Return to active cell | Excel Discussion (Misc queries) | |||
Excel: copy grid, widths & heights down page: heights wrong! why? | Excel Discussion (Misc queries) | |||
Function to return the active sheet name | Excel Worksheet Functions |