copy rows and paste onto visible only

R

rk0909

All,

I want to copy say 10 rows and then paste into another 10 rows. Problem is
the destination rows are not contiguous. there are 4-5 rows in between each
of these rows which are grouped.

is there a way to do that. I tried the visible cells property but that does
not work.

Any help of direction is much appreciated.

thanks much,

RK
 
O

ozgrid.com

Something like;

Sub CopyToVisibleRows()
Dim rCell As Range, rCell2 As Range
Dim lPasteRow As Long

lPasteRow = 1
For Each rCell In Sheet1.Range("A1:A10")
rCell.EntireRow.Copy
For Each rCell2 In Sheet2.Range("A1:A100")
If rCell2.EntireRow.Hidden = False And rCell2.Row > lPasteRow
Then
lPasteRow = rCell2.Row
rCell2.PasteSpecial
Application.ScreenUpdating = False
End If
Next rCell2
Next rCell
End Sub
 
O

ozgrid.com

Oops "Application.ScreenUpdating = False"

Should be;
Application.CutCopyMode=False
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top