I am working on Excel macro. What i need when getting data from another excel sheet, code should first check if there is any other row with the same FundName and if found th
Replace this:
Set FindRow = shtData.Range(CCell, DCell).Find(What:=SearchString, LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
Set NextRow = shtData.Range(CCell, DCell).FindNext(After:=FindRow)
With:
If WorksheetFunction.CountIf(CCell.EntireColumn, SearchString) > 1 Then
'Duplicate found, do something here
Else
'Unique string, do something here
End If
Or
If Evaluate("COUNTIF(" & CCell.EntireColumn.Address & "," & SearchString & ")") > 1 Then
'Duplicate found, do something here
Else
'Unique string, do something here
End If