Soru Makro ile satır aç kaydet sonra gizle

sirkülasyon

Altın Üye
Katılım
10 Temmuz 2012
Mesajlar
2,518
Excel Vers. ve Dili
2021 LTSC TR
Altın Üyelik Bitiş Tarihi
18-06-2026
Kod:
Private Sub CommandButton1_Click()

Dim Nesne As Control
    For Each Nesne In Controls
        Select Case TypeName(Nesne)
            Case "TextBox", "ComboBox"
            If Nesne = "" Then
                MsgBox "Eksik veri girişi var", vbCritical, "D İ K K A T !!!"
                Exit Sub
            End If
        End Select
    Next

 For satir = 4 To 31
        Rows(satir & ":" & satir).EntireRow.Hidden = False
Next satir

    Dim Bak As Range
    If Range("B31") <> "" Then
        MsgBox "'B4:B31' arası dolu, kayıt yapılamıyor"
        Exit Sub
    End If
  
    For Each Bak In Range("B4:B31")
        If Bak = "" Then
            Bak = TextBox1.Text
            Bak.Offset(0, 1) = TextBox2.Text
            Bak.Offset(0, 2) = ComboBox1.Text
            Bak.Offset(0, 3) = TextBox3.Text
            ListView1.ListItems.Clear
            Listele
    TextBox1 = ""
    TextBox2 = ""
    TextBox3 = ""
    ComboBox1 = ""
    
    Dim SonSatir As Integer
SonSatir = Range("E31").End(xlUp).Row
Range("B3:E" & SonSatir + 1).Borders.LineStyle = 1
 
  For satir = 4 To 31
 
    If Cells(satir, 2) = Empty Then
        Rows(satir & ":" & satir).EntireRow.Hidden = True
    End If
Next satir



With Range("B3:E" & SonSatir + 1)
        .Borders.LineStyle = xlNone
        .Borders.LineStyle = xlContinuous
        .Borders(xlEdgeLeft).Weight = xlMedium
        .Borders(xlEdgeTop).Weight = xlMedium
        .Borders(xlEdgeBottom).Weight = xlMedium
        .Borders(xlEdgeRight).Weight = xlMedium
End With

With Range("B3:E3")
        .Borders.LineStyle = xlNone
        .Borders.LineStyle = xlContinuous
        .Borders(xlEdgeLeft).Weight = xlMedium
        .Borders(xlEdgeTop).Weight = xlMedium
        .Borders(xlEdgeBottom).Weight = xlMedium
        .Borders(xlEdgeRight).Weight = xlMedium
End With
    
 
            Exit Sub
        End If
    Next
  
End Sub
İlk Eksik Giriş var ise uyaracak
Ardından Gizlenmiş satırları açacak
Veriyi kaydedecek
Çizgisini ekleyecek
Akabinde Boş satırları gizleyecek.

Yukarıda ki kod ile bunu yapmaya çalıştım ama ilkönce hata veriyor. Bayağı bekledekten sonra kayıt yapıyor.
Rica etsem kodun düzenlenmesi için yardımcı olabilir misiniz?
 
Üst