Cells.Find Issue! HEEELP!

garden_rael

Board Regular
Joined
Apr 1, 2008
Messages
100
I'm trying to run a macro that would do some stuff. but before it does, I want it to search for a cell value to see if I'm not entering the same IDCode..

Ex...

You fill Cell C4 with the ID
then fill some other cells with other stuff

The macro will pull that info and add it into a data base... that's already resolved...

My problem is that, if the ID 001 is already entered, It shouldn't be possible to re-enter it...

This is the part where I'm presenting issues

Application.ScreenUpdating = False
Sheets("Base").Activate
Range("A1").Activate
Selection.End(xlDown).Select
v1 = ActiveCell.Row + 1
Sheets("Formulario").Activate
Range("C4").Activate
v2 = ActiveCell.Value
Sheets("Base").Activate
Range("A1").Activate
v3 = Cells.Find(What:=v2, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
If v3 = True Then
a = MsgBox("Su ID ya esta registrado, si esto es un error, por favor verifique con el Administrador", vbOKOnly)
Exit Sub



Help me!!! I'm losing my mind! lol :confused:
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
The thing is that this is a form like sheet..

So... you fill it and once it is done you run a macro that will populate what you answered on a data base...

So I need some function to prevent duplicate ID's on my database...

But users don't have access to the database
 
Upvote 0
See if this helps you at all..

Code:
Private Sub doit2_Click()
    v2 = ActiveCell.Value
    With Worksheets("Base").Range("a1:a" & Cells(Rows.Count, "A").End(xlUp).Row)
        Set c = .Find(v2, LookIn:=xlValues)
        If Not c Is Nothing Then
           Results = MsgBox("Duplicate ID", vbOKOnly)
           Exit Sub
        Else
            'Do your thing here....
        End If
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,579
Messages
6,125,646
Members
449,245
Latest member
PatrickL

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top