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
 
K

kasia

I was just looking for the similar solution (pasting 1 column range o
cells into another sheet filtered visible vertical range).
I tried this code, but I get errors with adressin
(Sheet1.Range("A1:A10") is not recognized even after changing the sheet
names), so I changed code into:

Sheets("Sheet1").Select
ActiveCell.Select
Range(Selection, Selection.End(xlDown)).Select
For Each Cell In Selection
ActiveCell.EntireRow.Copy
Sheets("Sheet1").Select
ActiveCell.Select
Range(Selection, Selection.End(xlDown)).Select
For Each rCell2 In Selection

it works well, but then I've got message with line:

If rCell2.EntireRow.Hidden = False And rCell2.Row lPasteRow
Compile error: Syntax error

I have some experience in using makros in Excel, but to little I'
afraid to manage this, so please help!
 

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