PDA

View Full Version : Help with copy paste code



greyangel
07-28-2017, 11:46 AM
19917

Attached is an example of what I am trying to do. I am trying to copy all visible lines to the next blank cell in the "unmatched Files" tab, however I keep getting an error when running the macro.

mana
07-28-2017, 03:31 PM
Option Explicit


Sub test()
Dim r As Range

With Sheets("Unmatched")
If .AutoFilterMode = False Then Exit Sub
Set r = .AutoFilter.Range
If r.Columns(1).SpecialCells(xlCellTypeVisible).Count > 1 Then
r.Offset(1).Copy Sheets("Unmatched Files").Range("A" & Rows.Count).End(xlUp).Offset(1)
End If
End With

End Sub

greyangel
07-31-2017, 05:01 AM
Option Explicit


Sub test()
Dim r As Range

With Sheets("Unmatched")
If .AutoFilterMode = False Then Exit Sub
Set r = .AutoFilter.Range
If r.Columns(1).SpecialCells(xlCellTypeVisible).Count > 1 Then
r.Offset(1).Copy Sheets("Unmatched Files").Range("A" & Rows.Count).End(xlUp).Offset(1)
End If
End With

End Sub


Thank you for helping me out. I will be trying this out today and I will tell you if it works out for me. :)

greyangel
08-08-2017, 11:14 AM
Mana thank you for all your help this worked out great.