Copy & Paste visible cells only

S

Scott

Is it possible to copy and paste visible cells only?

Thanks


Selection.Copy
'Add a new workbook and copy selected range
Workbooks.Add
Range("a1").Select
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone, SkipBlanks:=
_
False, Transpose:=False

Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=
_
False, Transpose:=False
 
E

Ed

In Excel 2000, I use only
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=_
False, Transpose:=False
and it works fine for me. Yes, you'd have to add the Paste Formats to get
that; I didn't bother. But it did paste only the cells visible after
AutoFilter and hiding.

HTH
Ed
 
T

Tom Ogilvy

Unless you data is from a filtered range, you would have to copy only the
visible cells

Edit=>Goto =>Special, select Visible.

Then do your copy
 
J

JE McGimpsey

One way:

Dim rCopy As Range
On Error Resume Next 'in case no visible cells selected
Set rCopy = Selection.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rCopy Is Nothing Then _
rCopy.Copy Destination:=Workbooks.Add.Sheets(1).Range("A1")
 
S

Scott

Thank you! That worked great.




JE said:
One way:

Dim rCopy As Range
On Error Resume Next 'in case no visible cells selected
Set rCopy = Selection.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rCopy Is Nothing Then _
rCopy.Copy Destination:=Workbooks.Add.Sheets(1).Range("A1")
 

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