Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Different cell heights within worksheet Kapoho Surfer New Users to Excel 2 May 12th 10 06:20 AM
Copy Value of Active cell and 25 rows above to a diff worksheet ash3154 Excel Discussion (Misc queries) 4 September 2nd 09 12:56 AM
Return to active cell Alex.W Excel Discussion (Misc queries) 2 June 19th 07 11:35 PM
Excel: copy grid, widths & heights down page: heights wrong! why? K Excel Discussion (Misc queries) 1 June 24th 06 03:06 AM
Function to return the active sheet name Will Excel Worksheet Functions 2 August 23rd 05 04:33 PM


All times are GMT +1. The time now is 10:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"