#1   Report Post  
Posted to microsoft.public.excel.misc
CY CY is offline
external usenet poster
 
Posts: 1
Default Row Height property

A client has a spreadsheet with some rows set at either zero or close to
zero height and he wants to copy only those (what he calls)"hidden" rows to
another sheet for comparison to different data. I realize that he should
not have done it this way (better to have filtered the data) but he does not
want to go back and unhide and mark each row. Any way to create VBA - or
maybe an easier way - that looks at the row height property and returns the
values??

TIA


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,510
Default Row Height property

Hi CY,

The following macro copies to a separate sheet all the rows with height less
than 5 plus hidden rows. I did it this way because it is possible that your
client has inadvertantly hidden rows mixed with ones of minimum height.
Adjust the minimum height of row if required.

Selecting the destination rows has been done with a method which does not
require the cells in column 1 to have data because I don't know if all cells
in column 1 have data.

You will need to edit the line which sets the range of rows to look at. Hard
to use alternative methods such as UsedRange or the End(xlUp) method because
with hidden rows it depends where they are whether they will cause a problem
using these alternative methods.

If you have any problems with it then feel free to get back to me.

Sub Macro1()
Dim rngSht1 As Range
Dim r As Range
Dim wsSht1 As Worksheet
Dim wsSht2 As Worksheet
Dim sht2Row As Single

Set wsSht1 = Sheets("Sheet1")
Set wsSht2 = Sheets("Sheet2")

'Set max rows to include all the data.
Set rngSht1 = wsSht1.Rows("1:30")

sht2Row = 2
For Each r In rngSht1.Rows
If r.RowHeight < 5 Or r.Hidden = True Then
r.EntireRow.Copy Destination:= _
wsSht2.Cells(sht2Row, 1)
sht2Row = sht2Row + 1
End If
Next r

wsSht2.Cells.EntireRow.Hidden = False
wsSht2.Cells.Rows.AutoFit

End Sub


Regards,

OssieMac





"CY" wrote:

A client has a spreadsheet with some rows set at either zero or close to
zero height and he wants to copy only those (what he calls)"hidden" rows to
another sheet for comparison to different data. I realize that he should
not have done it this way (better to have filtered the data) but he does not
want to go back and unhide and mark each row. Any way to create VBA - or
maybe an easier way - that looks at the row height property and returns the
values??

TIA



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
Caption Property the dude Excel Discussion (Misc queries) 1 June 1st 06 10:23 AM
need to dbl row height without changing height of cell next to it Excel-Illiterate New Users to Excel 1 May 16th 06 01:08 AM
ScrollBar property Ben Excel Discussion (Misc queries) 1 October 31st 05 06:25 AM
Resizing row height to dynamically fit height of text box Jon Excel Discussion (Misc queries) 1 August 8th 05 01:37 PM
resize row height and column height Tom Setting up and Configuration of Excel 3 April 3rd 05 02:03 PM


All times are GMT +1. The time now is 02:24 AM.

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

About Us

"It's about Microsoft Excel"