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
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
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
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