kayıt silme

Katılım
1 Şubat 2007
Mesajlar
516
Excel Vers. ve Dili
excel2003
slm
Private Sub kayitsil_Click()
If MsgBox("Silmek istediğinizden, Emin misiniz?", vbYesNo, "Kayıtlı Personel Silme") = vbYes Then
Selection.EntireRow.Delete
End If
box1.Text = ""
box2.Text = ""
box3.Text = ""
box4.Text = ""
box5.Text = ""
box6.Text = ""
box7.Text = ""
box8.Text = ""
box9.Text = ""
box10.Text = ""
box11.Text = ""
box12.Text = ""
box13.Text = ""
box14.Text = ""
box15.Text = ""
box16.Text = ""
box17.Text = ""
box18.Text = ""
box19.Text = ""
box20.Text = ""
Call ListBox1_Click
Call ListBox2_Change
End Sub

kodunu kullanarak yapılan bir kaydı silebiliyoruz.Bu kod satır silerek gerçekleştiriyor. Buna alternatif olarak sadece içeriği temizleyen bir kod var mı? Teşekkürler
 

Orion1

Uzman
Uzman
Katılım
1 Mart 2005
Mesajlar
22,254
Excel Vers. ve Dili
Win7 Home Basic TR 64 Bit

Ofis-2010-TR 32 Bit
Kod:
Selection.EntireRow.Delete
Yerine aşağıdaki kodu kullanmanız yeterlidir.:cool:
Kod:
Selection.ClearContents
 
Katılım
1 Şubat 2007
Mesajlar
516
Excel Vers. ve Dili
excel2003
Hocam sadece a hücresindeki bilgiyi siliyor. satırdaki tüm bilgileri (içerik) nasıl sileriz.Teşekkürler
 
Katılım
1 Şubat 2007
Mesajlar
516
Excel Vers. ve Dili
excel2003
Teşekkürler Hocam bu seferde kayıtta problem yaşıyorum. Kayıt son satıra yaptığı için. aradaki bir bilgiyi sildiğimde örneğin 10 satır dolu 7. satırdaki bilgiyi sildim. yeni bir kayıt yapmak istiyorum 11. satıra yapıyor. boş satıra yapma imkanı var mı? kayıtta kullandığım kod aşağıdadır.
Private Sub CommandButton27_Click()
If ListBox2.ListIndex = -1 Then MsgBox ("Kaydedilecek sayfayı seçiniz."): Exit Sub
On Error Resume Next
Sheets(ListBox2.Value).Activate
Range("a2").Select
If box1.Text = Empty Then
MsgBox ("Ad kısmını boş geçmeyiniz"), vbOKOnly, "Uyarı!!!": Exit Sub
Else
End If
If box2.Text = Empty Then
MsgBox ("T.C. yazmak mecburidir"), , "Uyarı!!!": Exit Sub
Else
End If
'kodlar
pir = False
sonsatir = Cells(65536, 1).End(xlUp).Row
For X = 2 To sonsatir
If Cells(X, 1) & Cells(X, 2) = box1 & box2 Then
pir = True
sira = X
Exit For
End If
Next X
If pir = False Then
Cells(sonsatir + 1, 1) = box1
Cells(sonsatir + 1, 2) = box2
Cells(sonsatir + 1, 3) = box3
Cells(sonsatir + 1, 4) = box4
Cells(sonsatir + 1, 5) = box5
Cells(sonsatir + 1, 6) = box6
Cells(sonsatir + 1, 7) = box7
Cells(sonsatir + 1, 8) = box8
Cells(sonsatir + 1, 9) = box9
Cells(sonsatir + 1, 10) = box10
Cells(sonsatir + 1, 11) = box11
Cells(sonsatir + 1, 12) = box12
Cells(sonsatir + 1, 13) = box13
Cells(sonsatir + 1, 14) = box14
Cells(sonsatir + 1, 15) = box15
Cells(sonsatir + 1, 16) = box16
Cells(sonsatir + 1, 17) = box17
Cells(sonsatir + 1, 18) = box18
Cells(sonsatir + 1, 19) = box19
Cells(sonsatir + 1, 20) = box20
MsgBox (sonsatir + 1 & ". sıraya kaydı yapıldı.")
Else
MsgBox ("Bu kayıt daha önce girilmiş..." & sira & ". satir")
End If
ListBox1.Clear

Call ListBox1_Change
Call box1_Enter
End Sub

Teşekkürler
 

Orion1

Uzman
Uzman
Katılım
1 Mart 2005
Mesajlar
22,254
Excel Vers. ve Dili
Win7 Home Basic TR 64 Bit

Ofis-2010-TR 32 Bit
Aşağıdaki kodları deneyiniz.:cool:
Kod:
Private Sub CommandButton1_Click()
[B][COLOR="Red"]Dim sat As Long[/COLOR][/B]
If ListBox2.ListIndex = -1 Then MsgBox ("Kaydedilecek sayfayı seçiniz."): Exit Sub
On Error Resume Next
Sheets(ListBox2.Value).Activate
Range("a2").Select
If box1.Text = Empty Then
MsgBox ("Ad kısmını boş geçmeyiniz"), vbOKOnly, "Uyarı!!!": Exit Sub
Else
End If
If box2.Text = Empty Then
MsgBox ("T.C. yazmak mecburidir"), , "Uyarı!!!": Exit Sub
Else
End If
'kodlar
pir = False
sonsatir = Cells(65536, 1).End(xlUp).Row
[B][COLOR="red"]sat = 2
Do While Cells(sat, "A").Value <> ""
    sat = sat + 1
Loop[/COLOR][/B]
For X = 2 To sonsatir
If Cells(X, 1) & Cells(X, 2) = box1 & box2 Then
pir = True
sira = X
Exit For
End If
Next X
If pir = False Then
Cells([B][COLOR="red"]sat[/COLOR], [/B]1) = box1
Cells([B][COLOR="red"]sat[/COLOR][/B], 2) = box2
Cells([B][COLOR="red"]sat[/COLOR][/B], 3) = box3
Cells([B][COLOR="red"]sat[/COLOR][/B], 4) = box4
Cells([B][COLOR="red"]sat[/COLOR][/B], 5) = box5
Cells([B][COLOR="red"]sat[/COLOR][/B], 6) = box6
Cells([B][COLOR="red"]sat[/COLOR][/B], 7) = box7
Cells([B][COLOR="red"]sat[/COLOR][/B], 8) = box8
Cells([B][COLOR="red"]sat[/COLOR][/B], 9) = box9
Cells([B][COLOR="red"]sat[/COLOR][/B], 10) = box10
Cells([B][COLOR="red"]sat[/COLOR][/B], 11) = box11
Cells([B][COLOR="red"]sat[/COLOR][/B], 12) = box12
Cells([B][COLOR="red"]sat[/COLOR][/B], 13) = box13
Cells([B][COLOR="red"]sat[/COLOR][/B], 14) = box14
Cells([B][COLOR="red"]sat[/COLOR][/B], 15) = box15
Cells([B][COLOR="red"]sat[/COLOR][/B], 16) = box16
Cells([B][COLOR="red"]sat[/COLOR][/B], 17) = box17
Cells([B][COLOR="red"]sat[/COLOR][/B], 18) = box18
Cells([B][COLOR="red"]sat[/COLOR][/B], 19) = box19
Cells([B][COLOR="red"]sat[/COLOR][/B], 20) = box20
MsgBox ([B][COLOR="red"]sat[/COLOR][/B] & ". s&#305;raya kayd&#305; yap&#305;ld&#305;.")
Else
MsgBox ("Bu kay&#305;t daha &#246;nce girilmi&#351;..." & sira & ". satir")
End If
ListBox1.Clear

Call ListBox1_Change
Call box1_Enter
End Sub
 
Katılım
1 Şubat 2007
Mesajlar
516
Excel Vers. ve Dili
excel2003
Te&#351;ekk&#252;rler Hocam bi harikas&#305;n&#305;z imrenmemek elde de&#287;il.
 

Orion1

Uzman
Uzman
Katılım
1 Mart 2005
Mesajlar
22,254
Excel Vers. ve Dili
Win7 Home Basic TR 64 Bit

Ofis-2010-TR 32 Bit
Te&#351;ekk&#252;rler Hocam bi harikas&#305;n&#305;z imrenmemek elde de&#287;il.
Rica ederim.
Yaln&#305;z bu metodda bir sak&#305;nca var.
O'da b&#252;y&#252;k miktarlarda veri giri&#351;inde yani sat&#305;r say&#305;s&#305; artt&#305;k&#231;a d&#246;ng&#252;'n&#252;n &#231;al&#305;&#351;mas&#305; uzayacak ve veri girmesi zaman&#305; uzayacakt&#305;r.Yani program yava&#351;layabilir.
Ama sizin istedi&#287;inizde ancak bu y&#246;ntemle yap&#305;labilir kanaatindeyim.:cool:
 
Katılım
1 Şubat 2007
Mesajlar
516
Excel Vers. ve Dili
excel2003
Slm.
UserFormdan Butonla &#246;rne&#287;in b2:k25 aral&#305;&#287;&#305;n&#305;n sadece i&#231;eri&#287;ini silmek istiyorum. Nas&#305;l Bir kod kullanmal&#305;y&#305;m(sat&#305;r ya da s&#252;tun silmeden)
 

Orion1

Uzman
Uzman
Katılım
1 Mart 2005
Mesajlar
22,254
Excel Vers. ve Dili
Win7 Home Basic TR 64 Bit

Ofis-2010-TR 32 Bit
Aşağıdaki kodu deneyiniz.:cool:
Kod:
Range("B2:K25").ClearContents
 

Orion1

Uzman
Uzman
Katılım
1 Mart 2005
Mesajlar
22,254
Excel Vers. ve Dili
Win7 Home Basic TR 64 Bit

Ofis-2010-TR 32 Bit
Hocam bu kodla seçili satırı siliyoruz seçili satırda mesela A:W arasını silme imkanımız var mı?
Aşağıdaki kod seçili satırda A:W aralığını siler.:cool:
Kod:
Range(Cells(Selection.Row, "A"), Cells(Selection.Row, "W")).ClearContents
 
Üst