• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

aynı veride uyarı

hatirlabeni

Altın Üye
Katılım
14 Ekim 2011
Mesajlar
207
Excel Vers. ve Dili
Excel Vers. ve Dili Ofis 2016 TR 32 Bit
Kolay gelsin

A1 -A1000 sutununda veri ekliyorum. Bu aralıklarda ilk yazmış oldugum T.C. kimlik numarasından sonra aynısını tekrar baska yazınca bana uyarı vermesini istiyorum . T.C Kayıtlarda mevcut diye bunu nasıl sağlayabilirim. ?
 
Merhaba,

Bu işlemi yapmak istediğiniz sayfanızın kod bölümüne aşağıdaki kodu uygulayıp deneyin.

Kod:
Private Sub Worksheet_Change(ByVal Target As Range)
    On Error GoTo Son
    If Intersect(Target, Range("A1:A1000")) Is Nothing Then Exit Sub
    If Target.Cells.Count > 1 Then Exit Sub
    If Target <> "" Then
    If WorksheetFunction.CountIf(Columns(1), Target) > 1 Then
        MsgBox "Mükerrer kayıt !", vbCritical
        Target.ClearContents
        Target.Select
        Exit Sub
    End If
    End If
Son:
End Sub
 
hocam kodu ayrı sayfada kullanınca sorunsz çalışıyor fakat kendi sayfama ekleyince hata veriyor acaba nedeni sayfamda ekli olan diğer kodlardan mı kaynaklanıyor ?
 
Merhaba,

Boş dosyada doğru çalışıyorsa; hatanın sebebi büyük ihtimalle sizin dosyanızda benzer kodlardan kaynaklanıyordur. Kodları birleştirip düzenlemeniz gerekebilir.
 
Kod:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("E:E")) Is Nothing Then Exit Sub
If Cells(Target.Row, "E") > "" Then
Range("A2:K65536").Select
    Selection.Sort Key1:=Range("E2"), Order1:=xlAscending, Header:=xlGuess, _
        OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
        DataOption1:=xlSortNormal
    Range("A65536").End(3).Select
End If
End Sub

kullanmıs oldugum kodlar bunlar Hocam.
 
Kodları nasıl birleştire bilirim ?
 
Merhaba,

Aşağıdaki kodu deneyiniz.

Kod:
Private Sub Worksheet_Change(ByVal Target As Range)
    On Error GoTo Son
    If Intersect(Target, Range("A1:A1000,E:E")) Is Nothing Then Exit Sub
    If Target.Cells.Count > 1 Then Exit Sub
    If Target <> "" And Target.Column = 1 Then
        If WorksheetFunction.CountIf(Columns(1), Target) > 1 Then
            MsgBox "Mükerrer kayıt !", vbCritical
            Target.ClearContents
            Target.Select
            Exit Sub
        End If
    ElseIf Target <> "" And Target.Column = 5 Then
        Range("A2:K" & Rows.Count).Sort Key1:=Range("E2"), Order1:=xlAscending
        Range("A" & Rows.Count).End(3).Select
    End If
Son:
End Sub
 
Hocam Ellerinize Sağlık Kolay Gelsin ...
 
Geri
Üst