VBA AdvancedFilter Filter and copy unique cells without empty (empty) cells

I'm new to VBA and stackoverflow.com too

I use this code to remove duplicate cells in a column where I copy unique cells to the next column, but the code counts empty non-empty cells for unique data. Good, but I don't need to copy an empty cell to a new column.

ActiveSheet.Range("BA4:BA59").AdvancedFilter _
Action:=xlFilterCopy, _
CopyToRange:=ActiveSheet.Range("BB4"), _
UNIQUE:=True

I searched and found

SkipBlanks:=True

but when I add it, the code goes to hell;)

Please tell me how to skip spaces and "cels" The duplicate column contains the IF IF (A4 = "Print", "Text to Print", ") and IF (A4 =" Cut "," Cut Text "," " ) Possible results in cells

  • Printable Text
  • Printable Text
  • ""
  • Text for cutting
  • Text for cutting

Therefore I need only in a new column

  • Printable Text
  • Text for cutting

Thank you in advance

0
1

: Advance AutoFilter

, BA1: BA2 :

=LEN(BA5)>0

.

enter image description here

, :

Range("BA4:BA9").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
    "BA1:BA2"), CopyToRange:=Range("BB4"), Unique:=True

, :

enter image description here

+1

Source: https://habr.com/ru/post/1673992/


All Articles