AFter much struggle let me turn to the board again maybe one of you can easily help me out.
I have made the following WS' change event to give a error message if the number entered in c13 already exists in the database which is queried in sheet4'b28 with a SQL.REQUEST.
So if the number doesnot exist b28 gives an error which means otherwise i need the message box and prevent the user to continue before entering antoher number............
Private Sub Worksheet_Change(ByVal Target As Range)
Dim nExiste As Integer
Dim Msg
Msg = "No pueden existir prestamos duplicados"
If Target.Address = "$c$13" Then
nExiste = IIf(IsError(Sheet4.Range("b28").Value), 0, Sheet4.Range("b28").Value)
If nExiste > 0 Then
MsgBox Prompt:=Msg, Buttons:=vbOKOnly, Title:="Error"
Continuar = False
End If
End If
End Sub
Code is accepted by not triggered by entering duplicate number in the cell.
What did i do wrong???
Joke
I have made the following WS' change event to give a error message if the number entered in c13 already exists in the database which is queried in sheet4'b28 with a SQL.REQUEST.
So if the number doesnot exist b28 gives an error which means otherwise i need the message box and prevent the user to continue before entering antoher number............
Private Sub Worksheet_Change(ByVal Target As Range)
Dim nExiste As Integer
Dim Msg
Msg = "No pueden existir prestamos duplicados"
If Target.Address = "$c$13" Then
nExiste = IIf(IsError(Sheet4.Range("b28").Value), 0, Sheet4.Range("b28").Value)
If nExiste > 0 Then
MsgBox Prompt:=Msg, Buttons:=vbOKOnly, Title:="Error"
Continuar = False
End If
End If
End Sub
Code is accepted by not triggered by entering duplicate number in the cell.
What did i do wrong???
Joke