Solved Delete a particular value when using WorksheetFunction.Count

May 23, 2019 at 18:19:34
Specs: Windows 7
I am using the following code by DerbyDad03, I need to modify it a bit to delete the value "<UNASSIGNED>". I am using this code to create a list of email addresses but some of the data does not have an email address assigned so the field has the text "<UNASSIGNED>". I want to ignore this value.

'At each name, use COUNTIF to look upwards and see if the name already exists.
'If not, add name, semi-colon and space to temporary name list
         If WorksheetFunction.CountIf(Range("C2:C" & x), Range("C" & x)) < 2 Then
             namelist_tmp = namelist_tmp & Range("C" & x) & "; "
         End If
      Next
'Strip last semi-colon & space off of temp list
          namelist = Left(namelist_tmp, Len(namelist_tmp) - 2)


See More: Delete a particular value when using WorksheetFunction.Count

Report •

#1
May 23, 2019 at 19:44:37
✔ Best Answer
I was able to make this work by adding a second IF statement

If WorksheetFunction.CountIf(Range("C2:C" & x), "<>" & "<UNASSIGNED>") Then
If WorksheetFunction.CountIf(Range("C2:C" & x), Range("C" & x)) < 2 Then

message edited by mecerrato


Report •
Related Solutions


Ask Question