I have a table of data and I want to delete rows where the data is duplicate in row G. Right now I"m using an advanced filter for unique values only
Range("A1:J150").Sort Key1:=Range("I2"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("G:G").AdvancedFilter Action:=xlFilterInPlace, Unique:=True
This works, BUT I also need to do a COUNTIF formula based on column I (date column). So I only want it to count the visible rows. Or have the filter delete the duplicates its filtering. The rest of the code is below
Range("A199:A204").Select
Selection.Copy
Range("B199").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("C199").Select
ActiveCell.Formula = "=COUNTIF(I:I,B199)"
Range("C200").Select
ActiveCell.Formula = "=COUNTIF(I:I,B200)"
Range("C201").Select
ActiveCell.Formula = "=COUNTIF(I:I,B201)"
Range("C202").Select
ActiveCell.Formula = "=COUNTIF(I:I,B202)"
Range("C203").Select
ActiveCell.Formula = "=COUNTIF(I:I,B203)"
Range("C204").Select
ActiveCell.Formula = "=COUNTIF(I:I,B204)"
Range("A1:J150").Sort Key1:=Range("I2"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("G:G").AdvancedFilter Action:=xlFilterInPlace, Unique:=True
This works, BUT I also need to do a COUNTIF formula based on column I (date column). So I only want it to count the visible rows. Or have the filter delete the duplicates its filtering. The rest of the code is below
Range("A199:A204").Select
Selection.Copy
Range("B199").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("C199").Select
ActiveCell.Formula = "=COUNTIF(I:I,B199)"
Range("C200").Select
ActiveCell.Formula = "=COUNTIF(I:I,B200)"
Range("C201").Select
ActiveCell.Formula = "=COUNTIF(I:I,B201)"
Range("C202").Select
ActiveCell.Formula = "=COUNTIF(I:I,B202)"
Range("C203").Select
ActiveCell.Formula = "=COUNTIF(I:I,B203)"
Range("C204").Select
ActiveCell.Formula = "=COUNTIF(I:I,B204)"