• 5 Subscribers
  • 114 Views
-2

I need to copy the whole row from sheet1 to sheet 2 if Col f:f has any numbers ( number value will be different each time) but the second col K:K will say the same (invoice).

Example:

if f12 has $400 and K12 is Invoice than copy the whole row to sheet2

if f43 has $12,000 and K43 is Invoice than copy the whole row to sheet2

Here is what I have tried.

Public Sub test() 
    Dim r As Range 
    Set r = Worksheets(1).Range("A1").CurrentRegion r.AutoFilter Field:=11, Criteria1:="Invoice" 'Field 11 = column K    
    r.Columns(6).EntireColumn.SpecialCells(xlCellTypeConstants, 1).EntireRow.Copy Destination:=Worksheets(2).Cells(Rows.Count, 1).End(xlUp) '6 = Column F 
End Sub

It's giving me Subscription out of Range" Error.


0 answers in total

Answer this questsion