ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Finding a Duplicate using Vb (https://www.excelbanter.com/excel-programming/275362-finding-duplicate-using-vbulletin.html)

Rocky McKinley

Finding a Duplicate using Vb
 
Hi I'm trying to make a function which looks for duplicates using Vb.
Something
like...

'BigRange is always in worksheet "Main"
'Cell is always in worksheet "Print"
'something like below
Function DuplicateExists (BigRange as Range, Cell as Range) As Boolean
DuplicateExists = FalseIf cell exists in big Range and cell < "" then
DuplicateExists = True
End if
End Function

I prefer not to pass "Cell" to a worksheet cell as I will be testing many
Cells with this function and it will bog down Excel. Is there a speedy way
to do this using Vb.

I apologize about the re-post however I'm looking for the fastest Vb
solution.

--
Regards,
Rocky McKinley





Tom Ogilvy

Finding a Duplicate using Vb
 

Function DuplicateExists (BigRange as Range, Cell as Range) As Boolean
if not isempty(cell) then
if application.countif(BigRange,Cell) 0 then
DuplicateExists = True
End if
End if
End Function

--
Regards,
Tom Ogilvy



"Rocky McKinley" wrote in message
...
Hi I'm trying to make a function which looks for duplicates using Vb.
Something
like...

'BigRange is always in worksheet "Main"
'Cell is always in worksheet "Print"
'something like below
Function DuplicateExists (BigRange as Range, Cell as Range) As Boolean
DuplicateExists = FalseIf cell exists in big Range and cell < "" then
DuplicateExists = True
End if
End Function

I prefer not to pass "Cell" to a worksheet cell as I will be testing many
Cells with this function and it will bog down Excel. Is there a speedy

way
to do this using Vb.

I apologize about the re-post however I'm looking for the fastest Vb
solution.

--
Regards,
Rocky McKinley








All times are GMT +1. The time now is 03:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com