I wrote a line of code that was working until I made one little adjustment. The problem is that I don’t understand why my adjustment throws out the error: Run time error 1004, this command requires at least two rows of source data….
Working line of code:
Range("E1", Range("E65536").End(xlUp)).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("J1"), Unique:=True
Broken code: (LastRow is a long variable)
Range("E1", Range("E" & LastRow).End(xlUp)).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("J1"), Unique:=True
Try
Range("E1", "E" & LastRow).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("J1"), Unique:=True.It seemed like you were using
.End(xlUp)when you were already referencing the last row.