• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to paste Visible Cells Only

Abhijeet

Active Member
Hi

I have Data I use Auto filter then i want to paste but i can not paste in Filter Mode in particular selected data so can you please tell me how to paste in filter mode Visible cells in different workbook sheet
 
Code:
Sub PasteBack()
'Assumes Sheet1 (filtered) is active
    'get dataToCopy = sheet2.Range("A1").CurrentRegion      'aasume there's no header
    n = 1
    For i = 2 To Cells(Rows.Count, 1).End(xlUp).Row 'row 1 is header
    If Not Rows(i).Hidden Then
    dataToCopy.Offset(n - 1).Resize(1).Copy Cells(i, 1)
    n = n + 1
    If n > dataToCopy.Rows.Count Then Exit Sub
    End If
    Next
   
   
End Sub
In this link this mention
 
try this.


Code:
Sub copy_filter()

Sheet9.AutoFilter.Range.Copy
Sheet10.Range("A1").PasteSpecial xlPasteValues
Application.CutCopyMode = False

End Sub
 
Something like below

remove comment: which one suites you.

Code:
ActiveSheet.AutoFilter.Range.Copy
Workbooks.Add.Sheets(1).Paste
'or
'Workbooks("Book2").Sheets(1).Paste
'or
'Workbooks("Book2").Sheets("data").Range("D8").PasteSpecial xlPasteValues
Application.CutCopyMode = False
 
Hi Deepak

Can u please give me complete macro



Code:
sub test()
ActiveSheet.AutoFilter.Range.Copy
Workbooks.Add.Sheets(1).Paste
'or
'Workbooks("Book2").Sheets(1).Paste
'or
'Workbooks("Book2").Sheets("data").Range("D8").PasteSpecial xlPasteValues
Application.CutCopyMode = False
end sub
 
Hi

This macro Filter mode data copy & paste in new workbook

I do not want this i want filter mode to paste data means in which sheet i want to paste that sheet is filtered i want to paste can u please watch Mr excel Video then u able to understand what i want
 
that's the code is.

Code:
Sub PasteBack()
Dim dataToCopy As Range, n As Integer, i As Integer
'Assumes Sheet1 (filtered) is active
   Set dataToCopy = Sheet2.Range("A1").CurrentRegion      'aasume there's no header
   n = 1
    For i = 2 To Cells(Rows.Count, 1).End(xlUp).Row 'row 1 is header
   If Not Rows(i).Hidden Then
    dataToCopy.Offset(n - 1).Resize(1).Copy Cells(i, 1)
    n = n + 1
    If n > dataToCopy.Rows.Count Then Exit Sub
    End If
    Next
End Sub
 
Hi Deepak

Yes i want this this is paste in sheet2 i want to paste in another workbook particular sheet please tell me how to do this
 
Back
Top