ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Checks for duplicate entries (https://www.excelbanter.com/excel-programming/357939-checks-duplicate-entries.html)

Jennifer

Checks for duplicate entries
 
Hi there,
I have been searching the site and am not finding just a basic code that:
Looks at the invoice number being entered in the userform it then looks
through a range named "database" looking specifically in column "A" for the
number of matches and simply prompts a messages box saying "You have XX
number of matching invoice numbers do you still want to continue Yes/No"

Thank you for your help.
--
Though daily learning, I LOVE EXCEL!
Jennifer

Tom Ogilvy

Checks for duplicate entries
 
Dim cnt as Long
cnt = Application.Countif(Range("Database"),Trim(useform 1.Textbox1.Text))
If cnt 0 then
ans = msgbox ("You have " & cnt & " number of matching invoice
numbers",vbYesNo)

--
Regards,
Tom Ogilvy

"Jennifer" wrote in message
...
Hi there,
I have been searching the site and am not finding just a basic code that:
Looks at the invoice number being entered in the userform it then looks
through a range named "database" looking specifically in column "A" for

the
number of matches and simply prompts a messages box saying "You have XX
number of matching invoice numbers do you still want to continue Yes/No"

Thank you for your help.
--
Though daily learning, I LOVE EXCEL!
Jennifer




Jennifer

Checks for duplicate entries
 
Hey Tom,
Thanks! What would the code be if the person answers "No" for it to Exit Sub?

I think that'll do it. Thank you again.
--
Though daily learning, I LOVE EXCEL!
Jennifer


"Tom Ogilvy" wrote:

Dim cnt as Long
cnt = Application.Countif(Range("Database"),Trim(useform 1.Textbox1.Text))
If cnt 0 then
ans = msgbox ("You have " & cnt & " number of matching invoice
numbers",vbYesNo)

--
Regards,
Tom Ogilvy

"Jennifer" wrote in message
...
Hi there,
I have been searching the site and am not finding just a basic code that:
Looks at the invoice number being entered in the userform it then looks
through a range named "database" looking specifically in column "A" for

the
number of matches and simply prompts a messages box saying "You have XX
number of matching invoice numbers do you still want to continue Yes/No"

Thank you for your help.
--
Though daily learning, I LOVE EXCEL!
Jennifer





Jennifer

Checks for duplicate entries
 
Yeah for me I answered my own question. I'm learning though it may be at a
turtles pace:)
--
Though daily learning, I LOVE EXCEL!
Jennifer


"Jennifer" wrote:

Hey Tom,
Thanks! What would the code be if the person answers "No" for it to Exit Sub?

I think that'll do it. Thank you again.
--
Though daily learning, I LOVE EXCEL!
Jennifer


"Tom Ogilvy" wrote:

Dim cnt as Long
cnt = Application.Countif(Range("Database"),Trim(useform 1.Textbox1.Text))
If cnt 0 then
ans = msgbox ("You have " & cnt & " number of matching invoice
numbers",vbYesNo)

--
Regards,
Tom Ogilvy

"Jennifer" wrote in message
...
Hi there,
I have been searching the site and am not finding just a basic code that:
Looks at the invoice number being entered in the userform it then looks
through a range named "database" looking specifically in column "A" for

the
number of matches and simply prompts a messages box saying "You have XX
number of matching invoice numbers do you still want to continue Yes/No"

Thank you for your help.
--
Though daily learning, I LOVE EXCEL!
Jennifer






All times are GMT +1. The time now is 06:26 PM.

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