• DİKKAT

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

Soru Option Explicit hatası

sirkülasyon

Altın Üye
Katılım
10 Temmuz 2012
Mesajlar
2,543
Excel Vers. ve Dili
2021 LTSC TR
Kod:
Private Sub CommandButton1_Click()
Sheets("Personel").Select
If TextBox1.Text = "" Or TextBox2.Text = "" Then
MsgBox "İsim Girmeniz Gerekiyor"
Exit Sub
End If

Son_Dolu_Satir = Sheets("Personel").Range("b65536").End(xlUp).Row
Bos_Satir = Son_Dolu_Satir + 1
Sheets("Personel").Range("A" & Bos_Satir).Value = Application.WorksheetFunction.Max(Sheets("Personel").Range("A:A")) + 1
Sheets("Personel").Range("B" & Bos_Satir).Value = TextBox1.Text
Sheets("Personel").Range("C" & Bos_Satir).Value = TextBox2.Text
Sheets("Personel").Range("D" & Bos_Satir).Value = Hizmet.Value
Sheets("Personel").Range("E" & Bos_Satir).Value = Unvan.Value
Sheets("Personel").Range("F" & Bos_Satir).Value = ComboBox1.Value
Sheets("Personel").Range("G" & Bos_Satir).Value = TextBox3.Text
Sheets("Personel").Range("H" & Bos_Satir).Value = TextBox4.Text
MsgBox " Kayıt tamamlandı", vbCritical
ListBox1.ColumnCount = 1
ListBox1.RowSource = "Personel!B2:B" & Sheets("Personel").Range("B65536").End(xlUp).Row
ListBox1.ColumnWidths = "120"
Unload UserForm1
For d = [C65536].End(3).Row To 1 Step -1
If WorksheetFunction.CountIf(Range("C2:C" & d), Cells(d, "C")) = 1 Then
Exit Sub
End If


If WorksheetFunction.CountIf(Range("C2:C" & d), Cells(d, "C")) > 1 Then Rows(d).Delete
MsgBox " Çift TC KİMLİK kaydı bulundu ve son girişiniz iptal edildi.", vbCritical, "MÜKERRER"
Next
ThisWorkbook.Save
End Sub

Option Explicit silersem yukarıda ki kod çalışıyor. Bu sefer birbirine bağlı comboboxlar çalışmıyor.
Option Explicit silmezsem yukarıda ki kod çalışmıyor. Bu sefer birbirine bağlı comboboxlar çalışıyor.
Her iki kodunda çalışması için nasıl bir tanımlama yapmalıyım?
 
Option Explicit varken makro kodlarındaki değişkenleri tanımlamanız gerekiyor.
Private Sub CommandButton1_Click()
dim Son_Dolu_Satir as Integer
dim Bos_Satir as Integer
dim d as Integer
...
...
vb..
 
Teşekkür ederim. Çok çok sağ ol
Saygılarımla
 
Geri
Üst