Makroda bir hata var.

Katılım
4 Eylül 2007
Mesajlar
85
Excel Vers. ve Dili
eXCELL 2007
Runtime error 380 Hatası.

Merhaba arkadaşlar kendimce bu forumdaki kaynaklardan faydalanarak birşey yapmaya çalıştım ama bir türlü çalıştıramadım. Bir yerde bir sorun var ama anlamadım. Combobox olayından kaynaklanan bir hata. Uygulamada liste var bu listede görünen ürünlerden bir tanesini seçmeye çalıştığımı zaman hata veriyor. Bu hata runtime 380 hatası bu hatayı nasıl düzeltebiliriz. Saygılarımla
 
Son düzenleme:
Katılım
4 Eylül 2007
Mesajlar
85
Excel Vers. ve Dili
eXCELL 2007
Kodlarıda yapıştırayım. Belki kodlardan bakarak anlayan olur diye.

Kod:
Dim Yeni_mi As Boolean
'.............

Private Sub ComboBox1_Click()
TextBox1.Text = ComboBox1.Column(1)
End Sub

Private Sub ComboBox2_Click()
TextBox8.Text = ComboBox2.Column(1)
End Sub

Private Sub ComboBox3_Click()
TextBox9.Text = ComboBox3.Column(1)
End Sub

Private Sub ComboBox4_Click()
TextBox10.Text = ComboBox4.Column(1)
End Sub

Private Sub ComboBox5_Click()
TextBox11.Text = ComboBox5.Column(1)
End Sub

Private Sub ComboBox6_Click()
TextBox12.Text = ComboBox6.Column(1)
End Sub
Private Sub ComboBox7_Click()
TextBox20.Text = ComboBox7.Column(1)
End Sub

Private Sub ComboBox8_Click()
TextBox21.Text = ComboBox8.Column(1)
End Sub

Private Sub ComboBox9_Click()
TextBox22.Text = ComboBox9.Column(1)
End Sub

Private Sub ComboBox10_Click()
TextBox23.Text = ComboBox10.Column(1)
End Sub

Private Sub ComboBox11_Click()
TextBox24.Text = ComboBox11.Column(1)
End Sub

Private Sub ComboBox12_Click()
TextBox25.Text = ComboBox12.Column(1)
End Sub

Private Sub CommandButton1_Click()
If TextBox3.Text <> "" Then
    If TextBox4.Text <> "" Then
        If Yeni_mi = True Then
            
            For i = 2 To Sheets("Data").Range("A65536").End(xlUp).Row
                If UCase(Sheets("Data").Range("E" & i).Value) = UCase(TextBox1.Text) And _
                        UCase(Sheets("Data").Range("F" & i).Value) = UCase(TextBox2.Text) Then
                    MsgBox "Bu isimde bir kişi zaten kayıtlarda var", vbCritical, "MÜKERRER KAYIT BULUNDU"
                    Exit Sub
                End If
            Next i
            
            With Sheets("Data")
                Son_Dolu_Satir = .Range("A65536").End(xlUp).Row
                Bos_Satir = Son_Dolu_Satir + 1
                .Range("A" & Bos_Satir).Value = _
                            Application.WorksheetFunction.Max(.Range("A:A")) + 1
                
                .Range("C" & Bos_Satir).Value = TextBox1.Text
                .Range("D" & Bos_Satir).Value = TextBox2.Text
                .Range("E" & Bos_Satir).Value = TextBox3.Text
                .Range("F" & Bos_Satir).Value = TextBox4.Text
                .Range("G" & Bos_Satir).Value = TextBox5.Text
                .Range("H" & Bos_Satir).Value = TextBox6.Text
                .Range("K" & Bos_Satir).Value = TextBox7.Text
                .Range("P" & Bos_Satir).Value = TextBox8.Text
                .Range("R" & Bos_Satir).Value = TextBox9.Text
                .Range("T" & Bos_Satir).Value = TextBox10.Text
                .Range("V" & Bos_Satir).Value = TextBox11.Text
                .Range("X" & Bos_Satir).Value = TextBox12.Text
                .Range("Y" & Bos_Satir).Value = TextBox13.Text
                .Range("Z" & Bos_Satir).Value = TextBox14.Text
                .Range("AF" & Bos_Satir).Value = TextBox15.Text
                .Range("AG" & Bos_Satir).Value = TextBox16.Text
                .Range("AH" & Bos_Satir).Value = TextBox17.Text
                .Range("AI" & Bos_Satir).Value = TextBox18.Text
                .Range("AJ" & Bos_Satir).Value = TextBox19.Text
                .Range("AL" & Bos_Satir).Value = TextBox20.Text
                .Range("AN" & Bos_Satir).Value = TextBox21.Text
                .Range("AP" & Bos_Satir).Value = TextBox22.Text
                .Range("AR" & Bos_Satir).Value = TextBox23.Text
                .Range("AT" & Bos_Satir).Value = TextBox24.Text
                .Range("AV" & Bos_Satir).Value = TextBox25.Text
                .Range("B" & Bos_Satir).Value = ComboBox1.Text
                .Range("O" & Bos_Satir).Value = ComboBox2.Text
                .Range("Q" & Bos_Satir).Value = ComboBox3.Text
                .Range("S" & Bos_Satir).Value = ComboBox4.Text
                .Range("U" & Bos_Satir).Value = ComboBox5.Text
                .Range("W" & Bos_Satir).Value = ComboBox6.Text
                .Range("AK" & Bos_Satir).Value = ComboBox7.Text
                .Range("AM" & Bos_Satir).Value = ComboBox8.Text
                .Range("AO" & Bos_Satir).Value = ComboBox9.Text
                .Range("AQ" & Bos_Satir).Value = ComboBox10.Text
                .Range("AS" & Bos_Satir).Value = ComboBox11.Text
                .Range("AU" & Bos_Satir).Value = ComboBox12.Text
                .Range("AA" & Bos_Satir).Value = ComboBox13.Text
                .Range("AB" & Bos_Satir).Value = ComboBox14.Text
            End With
        
        Else
            Degistirilecek_Satir = ListBox1.ListIndex + 2
            With Sheets("Data")
                .Range("C" & Degistirilecek_Satir).Value = TextBox1.Text
                .Range("D" & Degistirilecek_Satir).Value = TextBox2.Text
                .Range("E" & Degistirilecek_Satir).Value = TextBox3.Text
                .Range("F" & Degistirilecek_Satir).Value = TextBox4.Text
                .Range("G" & Degistirilecek_Satir).Value = TextBox5.Text
                .Range("H" & Degistirilecek_Satir).Value = TextBox6.Text
                .Range("K" & Degistirilecek_Satir).Value = TextBox7.Text
                .Range("P" & Degistirilecek_Satir).Value = TextBox8.Text
                .Range("R" & Degistirilecek_Satir).Value = TextBox9.Text
                .Range("T" & Degistirilecek_Satir).Value = TextBox10.Text
                .Range("V" & Degistirilecek_Satir).Value = TextBox11.Text
                .Range("X" & Degistirilecek_Satir).Value = TextBox12.Text
                .Range("Y" & Degistirilecek_Satir).Value = TextBox13.Text
                .Range("Z" & Degistirilecek_Satir).Value = TextBox14.Text
                .Range("AF" & Degistirilecek_Satir).Value = TextBox15.Text
                .Range("AG" & Degistirilecek_Satir).Value = TextBox16.Text
                .Range("AH" & Degistirilecek_Satir).Value = TextBox17.Text
                .Range("AI" & Degistirilecek_Satir).Value = TextBox18.Text
                .Range("AJ" & Degistirilecek_Satir).Value = TextBox19.Text
                .Range("AL" & Degistirilecek_Satir).Value = TextBox20.Text
                .Range("AN" & Degistirilecek_Satir).Value = TextBox21.Text
                .Range("AP" & Degistirilecek_Satir).Value = TextBox22.Text
                .Range("AR" & Degistirilecek_Satir).Value = TextBox23.Text
                .Range("AT" & Degistirilecek_Satir).Value = TextBox24.Text
                .Range("AV" & Degistirilecek_Satir).Value = TextBox25.Text
                .Range("B" & Degistirilecek_Satir).Value = ComboBox1.Text
                .Range("O" & Degistirilecek_Satir).Value = ComboBox2.Text
                .Range("Q" & Degistirilecek_Satir).Value = ComboBox3.Text
                .Range("S" & Degistirilecek_Satir).Value = ComboBox4.Text
                .Range("U" & Degistirilecek_Satir).Value = ComboBox5.Text
                .Range("W" & Degistirilecek_Satir).Value = ComboBox6.Text
                .Range("AK" & Degistirilecek_Satir).Value = ComboBox7.Text
                .Range("AM" & Degistirilecek_Satir).Value = ComboBox8.Text
                .Range("AO" & Degistirilecek_Satir).Value = ComboBox9.Text
                .Range("AQ" & Degistirilecek_Satir).Value = ComboBox10.Text
                .Range("AS" & Degistirilecek_Satir).Value = ComboBox11.Text
                .Range("AU" & Degistirilecek_Satir).Value = ComboBox12.Text
                .Range("AA" & Degistirilecek_Satir).Value = ComboBox13.Text
                .Range("AB" & Degistirilecek_Satir).Value = ComboBox14.Text

            End With
        End If
    
        ListBox1.RowSource = "Data!E2:F" & Sheets("Data").Range("A65536").End(xlUp).Row
    
    Else
        MsgBox "Barkod Numarası Girmeniz Grekiyor"
    End If
Else
    MsgBox "Eser Adı Girmeniz Gerekiyor"
End If
End Sub

Private Sub CommandButton2_Click()
    Unload UserForm1
End Sub

Private Sub CommandButton3_Click()
    If ListBox1.ListIndex >= 0 Then
        cevap = MsgBox("Bilgi Silinecek ... Emin misiniz ?", vbYesNo, "SİLME ONAYI")
        If cevap = vbYes Then
            Yeni_mi = True
            Silinecek_Satir = ListBox1.ListIndex + 2
            Sheets("Data").Rows(Silinecek_Satir).Delete
            
            For Each nesne In UserForm1.Controls
                If TypeOf nesne Is MSForms.TextBox Then
                    nesne.Text = ""
                End If
            Next
'----------- Tüm TextBox'ları temizleyen alternatif kodlar ---------------------
'
'            For Each nesne In UserForm1.Controls
'                If TypeOf nesne Is MSForms.TextBox Then
'                    nesne.Text = ""
'                End If
'            Next
'----------------------------------------------------------------------
            ListBox1.RowSource = "Data!E2:F" & Sheets("Data").Range("A65536").End(xlUp).Row
        
        End If
    End If
End Sub

Private Sub CommandButton4_Click()
    Yeni_mi = True
    TextBox1.Text = ""
    TextBox2.Text = ""
    TextBox3.Text = ""
    TextBox4.Text = ""
    TextBox5.Text = ""
    TextBox6.Text = ""
    TextBox7.Text = ""
    TextBox8.Text = ""
    TextBox9.Text = ""
    TextBox10.Text = ""
    TextBox11.Text = ""
    TextBox12.Text = ""
    TextBox13.Text = ""
    TextBox14.Text = ""
    TextBox15.Text = ""
    TextBox16.Text = ""
    TextBox17.Text = ""
    TextBox18.Text = ""
    TextBox19.Text = ""
    TextBox20.Text = ""
    TextBox21.Text = ""
    TextBox22.Text = ""
    TextBox23.Text = ""
    TextBox24.Text = ""
    TextBox25.Text = ""
    ComboBox1.Text = ""
    ComboBox2.Text = ""
    ComboBox3.Text = ""
    ComboBox4.Text = ""
    ComboBox5.Text = ""
    ComboBox6.Text = ""
    ComboBox7.Text = ""
    ComboBox8.Text = ""
    ComboBox9.Text = ""
    ComboBox10.Text = ""
    ComboBox11.Text = ""
    ComboBox12.Text = ""
    ComboBox13.Text = ""
    ComboBox14.Text = ""
End Sub

'Private Sub ListBox1_Click()
'
'
'End Sub

Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
    Yeni_mi = False
    Bulunan_Satir_No = ListBox1.ListIndex + 2
    With Sheets("Data")
    TextBox1.Text = .Range("C" & Bulunan_Satir_No).Value
    TextBox2.Text = .Range("D" & Bulunan_Satir_No).Value
    TextBox3.Text = .Range("E" & Bulunan_Satir_No).Value
    TextBox4.Text = .Range("F" & Bulunan_Satir_No).Value
    TextBox5.Text = .Range("G" & Bulunan_Satir_No).Value
    TextBox6.Text = .Range("H" & Bulunan_Satir_No).Value
    TextBox7.Text = .Range("K" & Bulunan_Satir_No).Value
    TextBox8.Text = .Range("P" & Bulunan_Satir_No).Value
    TextBox9.Text = .Range("R" & Bulunan_Satir_No).Value
    TextBox10.Text = .Range("T" & Bulunan_Satir_No).Value
    TextBox11.Text = .Range("V" & Bulunan_Satir_No).Value
    TextBox12.Text = .Range("X" & Bulunan_Satir_No).Value
    TextBox13.Text = .Range("Y" & Bulunan_Satir_No).Value
    TextBox14.Text = .Range("Z" & Bulunan_Satir_No).Value
    TextBox15.Text = .Range("AF" & Bulunan_Satir_No).Value
    TextBox16.Text = .Range("AG" & Bulunan_Satir_No).Value
    TextBox17.Text = .Range("AH" & Bulunan_Satir_No).Value
    TextBox18.Text = .Range("AI" & Bulunan_Satir_No).Value
    TextBox19.Text = .Range("AJ" & Bulunan_Satir_No).Value
    TextBox20.Text = .Range("AL" & Bulunan_Satir_No).Value
    TextBox21.Text = .Range("AN" & Bulunan_Satir_No).Value
    TextBox22.Text = .Range("AP" & Bulunan_Satir_No).Value
    TextBox23.Text = .Range("AR" & Bulunan_Satir_No).Value
    TextBox24.Text = .Range("AT" & Bulunan_Satir_No).Value
    TextBox25.Text = .Range("AV" & Bulunan_Satir_No).Value
    ComboBox1.Text = .Range("B" & Bulunan_Satir_No).Value
    ComboBox2.Text = .Range("O" & Bulunan_Satir_No).Value
    ComboBox3.Text = .Range("Q" & Bulunan_Satir_No).Value
    ComboBox4.Text = .Range("S" & Bulunan_Satir_No).Value
    ComboBox5.Text = .Range("U" & Bulunan_Satir_No).Value
    ComboBox6.Text = .Range("W" & Bulunan_Satir_No).Value
    ComboBox7.Text = .Range("AK" & Bulunan_Satir_No).Value
    ComboBox8.Text = .Range("AM" & Bulunan_Satir_No).Value
    ComboBox9.Text = .Range("AO" & Bulunan_Satir_No).Value
    ComboBox10.Text = .Range("AQ" & Bulunan_Satir_No).Value
    ComboBox11.Text = .Range("AS" & Bulunan_Satir_No).Value
    ComboBox12.Text = .Range("AU" & Bulunan_Satir_No).Value
    ComboBox13.Text = .Range("AA" & Bulunan_Satir_No).Value
    ComboBox14.Text = .Range("AB" & Bulunan_Satir_No).Value
    End With
End Sub

Private Sub UserForm_Click()

End Sub

Private Sub UserForm_Initialize()
    Yeni_mi = True
    With ListBox1
        .ColumnCount = 2
        .ColumnWidths = "80;120"
        .RowSource = "Data!E2:F" & Sheets("Data").Range("A65536").End(xlUp).Row
    End With
    
    With ComboBox1
        .ColumnCount = 1
        .Style = fmStyleDropDownList
'       .ColumnWidths = "100"
        .RowSource = "veri!A2:B367"
    End With
    
    With ComboBox2
        .ColumnCount = 1
        .Style = fmStyleDropDownList
'       .ColumnWidths = "100"
        .RowSource = "veri!M2:N4"
    End With
    With ComboBox3
        .ColumnCount = 1
        .Style = fmStyleDropDownList
'       .ColumnWidths = "100"
        .RowSource = "veri!C2:D1953"
    End With
    
    With ComboBox4
        .ColumnCount = 1
        .Style = fmStyleDropDownList
'       .ColumnWidths = "100"
        .RowSource = "veri!E2:F36966"
    End With
    With ComboBox5
        .ColumnCount = 1
        .Style = fmStyleDropDownList
'       .ColumnWidths = "100"
        .RowSource = "veri!G2:H47"
    End With
    
    With ComboBox6
        .ColumnCount = 1
        .Style = fmStyleDropDownList
'       .ColumnWidths = "100"
        .RowSource = "veri!I2:J8101"
    End With
        With ComboBox7
        .ColumnCount = 1
        .Style = fmStyleDropDownList
'       .ColumnWidths = "100"
        .RowSource = "veri!A2:B367"
    End With
        With ComboBox8
        .ColumnCount = 1
        .Style = fmStyleDropDownList
'       .ColumnWidths = "100"
        .RowSource = "veri!A2:B367"
    End With
        With ComboBox9
        .ColumnCount = 1
        .Style = fmStyleDropDownList
'       .ColumnWidths = "100"
        .RowSource = "veri!A2:B367"
    End With
        With ComboBox10
        .ColumnCount = 1
        .Style = fmStyleDropDownList
'       .ColumnWidths = "100"
        .RowSource = "veri!E2:F36966"
    End With
        With ComboBox11
        .ColumnCount = 1
        .Style = fmStyleDropDownList
'       .ColumnWidths = "100"
        .RowSource = "veri!E2:F36966"
    End With
        With ComboBox12
        .ColumnCount = 1
        .Style = fmStyleDropDownList
'       .ColumnWidths = "100"
        .RowSource = "veri!E2:F36966"
    End With
        With ComboBox13
        .ColumnCount = 1
        .Style = fmStyleDropDownList
'       .ColumnWidths = "100"
        .RowSource = "veri!K2:K4"
    End With
        With ComboBox14
        .ColumnCount = 1
        .Style = fmStyleDropDownList
'       .ColumnWidths = "100"
        .RowSource = "veri!L2:K5"
    End With
End Sub
 
Katılım
4 Eylül 2007
Mesajlar
85
Excel Vers. ve Dili
eXCELL 2007
Arkadaşlar hatayı çözdüm burayada yazmak istedim. Hatanın sebebi. Kullanmadığım comboboxları boş bırakmamdan kaynaklanıyormuş. Yani Combobox boş durumda ise comboboxun veri aldığı yerdede boş bir hücre olmalı Bendeki hatanın sebebi boş olan comboboxun karşılığının olmamasıymış. Bende Comboboxların veri aldığı sutünların başına bir tanede boş hücre ekledim. Böylelikle boş bırakılan comboboxların da karşılığı olmuş oldu ve hata ortadan kalkmış oldu.
 
Son düzenleme:
Üst