Açıklama Silme

Katılım
26 Eylül 2020
Mesajlar
171
Excel Vers. ve Dili
excel 2019 pro.Türkçe
Altın Üyelik Bitiş Tarihi
26-09-2021
Aşağıdaki kod ile excel sayfasına açıklama ekliyorum.Textbox3'de tarih,textbox2'de isim var.İlgili tarih ve isim seçildiğinde textbox7'deki açıklama sayfadaki B" sütunundaki ilgili hücreye ekleniyor."A" sutununda isimler var.Yapmak istediğim textbox2 ve 3 'deki kritere göre ilgili açıklamayı silmek.Yardımcı olacak arkadaşa Teşekkür ederim.





trh = TextBox3
ara = TextBox2
deg = TextBox7

If deg = "" Then
MsgBox "Önce Açıklama Girin", vbInformation
Exit Sub
End If

Set c = [A:A].Find(ara, , xlValues, xlWhole)
If Not c Is Nothing Then
Adr = c.Address
Do
If Cells(c.Row, "B") = trh Then
Cells(c.Row, "B").ClearComments
Cells(c.Row, "B").AddComment
Cells(c.Row, "B").Comment.Text Text.Delete
Cells(c.Row, "B").Comment.Text Text:=deg
S = 1
End If
Set c = [A:A].FindNext(c)
Loop While Not c Is Nothing And c.Address <> Adr
End If

If S = 1 Then
MsgBox "Açıklama Eklendi", vbInformation
Else
MsgBox "Veri Bulunamadı", vbInformation
End If:
 

Ömer

Moderatör
Yönetici
Katılım
18 Ağustos 2007
Mesajlar
22,196
Excel Vers. ve Dili
Microsoft 365 Tr
Ofis 2016 Tr
Merhaba,

Kodlardaki kırmızı işaretli bölüm silme işlemini yapar. Kırmızı kalarak diğer 3 satırı silerseniz istediğiniz olur.

Cells(c.Row, "B").ClearComments
Cells(c.Row, "B").AddComment
Cells(c.Row, "B").Comment.Text Text.Delete
Cells(c.Row, "B").Comment.Text Text:=deg
 
Katılım
26 Eylül 2020
Mesajlar
171
Excel Vers. ve Dili
excel 2019 pro.Türkçe
Altın Üyelik Bitiş Tarihi
26-09-2021
Dediğinizi yaptım fakat "veri "bulunamadı uyarısı veriyor.Ayrıca üstteki kodu da yanlış yazmışım yeniden yazıyorum.

Dim trh As Date, ara As String, deg As String, c As Range, Adr As String

trh = TextBox3
ara = TextBox2
deg = TextBox7

If deg = "" Then
MsgBox "Önce Açıklama Girin", vbInformation
Exit Sub
End If

Set c = [A:A].Find(ara, , xlValues, xlWhole)
If Not c Is Nothing Then
Adr = c.Address
Do
If Cells(c.Row, "B") = trh Then
Cells(c.Row, "B").ClearComments
Cells(c.Row, "B").AddComment
Cells(c.Row, "B").Comment.Text Text:=""
Cells(c.Row, "B").Comment.Text Text:=deg
S = 1
End If
Set c = [A:A].FindNext(c)
Loop While Not c Is Nothing And c.Address <> Adr
End If

If S = 1 Then
MsgBox "Açıklama Eklendi", vbInformation
Else
MsgBox "Veri Bulunamadı", vbInformation
End If:
 

Ömer

Moderatör
Yönetici
Katılım
18 Ağustos 2007
Mesajlar
22,196
Excel Vers. ve Dili
Microsoft 365 Tr
Ofis 2016 Tr
Örnek ekleyerek detaylı açıklar mısınız.
 

Ömer

Moderatör
Yönetici
Katılım
18 Ağustos 2007
Mesajlar
22,196
Excel Vers. ve Dili
Microsoft 365 Tr
Ofis 2016 Tr
Deneyiniz.
Kod:
Private Sub CommandButton3_Click()

    Dim trh As Date, ara As String, c As Range, Adr As String

    trh = TextBox1
    ara = ComboBox1

    Set c = [A:A].Find(ara, , xlValues, xlWhole)
    If Not c Is Nothing Then
        Adr = c.Address
        Do
            If Cells(c.Row, "B") = trh Then
                Cells(c.Row, "A").ClearComments
                s = 1
            End If
            Set c = [A:A].FindNext(c)
        Loop While Not c Is Nothing And c.Address <> Adr
    End If

    If s = 1 Then
        MsgBox "Açıklama Silindi", vbInformation
    Else
        MsgBox "Veri Bulunamadı", vbInformation
    End If
    
End Sub
 
Katılım
26 Eylül 2020
Mesajlar
171
Excel Vers. ve Dili
excel 2019 pro.Türkçe
Altın Üyelik Bitiş Tarihi
26-09-2021
Elinize sağlık.Gayet güzel çalışıyor.
 
Üst