Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Finding next unhidden row

I am trying to find an efficient way to find the next unhidden row in
a range of cells. Normally this isn't a big issue, but when working
with a sheet with 100,000 rows, it can get really slow.

Here is some sample code of how I'm currently doing it.

DIM SourceCell, TargetCell as RANGE
Set SourceCell = Range("A1")

For Each TargetCell in Range("C1","C10000")
If TargetCell.RowHeight 0 then TargetCell.Value =
SourceCell.Value
Next TargetCell

Rather then looping through each cell in the range and checking the
height, is there a more efficient way to do it?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Finding next unhidden row


Hi

I think this is what you want:


Sub test()
Dim SourceCell As Range, TargetRange As Range
Set SourceCell = Range("A1")
Set TargetRange = Range("C1", "C10000")

Set TargetRange = TargetRange.SpecialCells(xlCellTypeVisible)
TargetRange.Value = SourceCell.Value
End Sub

Regards,
Per

"Cory Layman" skrev i meddelelsen
...
I am trying to find an efficient way to find the next unhidden row in
a range of cells. Normally this isn't a big issue, but when working
with a sheet with 100,000 rows, it can get really slow.

Here is some sample code of how I'm currently doing it.

DIM SourceCell, TargetCell as RANGE
Set SourceCell = Range("A1")

For Each TargetCell in Range("C1","C10000")
If TargetCell.RowHeight 0 then TargetCell.Value =
SourceCell.Value
Next TargetCell

Rather then looping through each cell in the range and checking the
height, is there a more efficient way to do it?


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
Copy Just UnHidden? Dave Birley Excel Programming 3 February 22nd 08 08:45 PM
unhidden row only Nahc Excel Discussion (Misc queries) 3 February 22nd 08 02:36 PM
unhidden row Nahc New Users to Excel 2 February 22nd 08 01:36 PM
sumif only for unhidden rows Bob Phillips Excel Worksheet Functions 5 December 11th 05 08:43 AM
Protecting a worksheet so it cant be unhidden ynissel Excel Discussion (Misc queries) 2 June 10th 05 08:59 PM


All times are GMT +1. The time now is 09:39 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"