Hi folks!

As most of you know I'm not a programmer.

I saw some code that uses advanced filter to extract unique entries to another location so I tried adding to it. Here's what I've come up with:

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False
On Error GoTo sub_exit

    If Not Intersect(Target, Range("A:A")) Is Nothing Then
    Columns("A:A").AdvancedFilter Action:=xlFilterCopy, _
    CopyToRange:=Range("D1"), Unique:=True

    End If

sub_exit:

Application.EnableEvents = True

End Sub
If the data in column A is not in a contiguous range the filter procedure considers empty cells a unique entry and includes the empty cell in the extraction range.

My question is: how to get this to ignore empty cells?