- Katılım
- 12 Nisan 2012
- Mesajlar
- 533
- Excel Vers. ve Dili
- Microsoft office professional plus 2019
- Altın Üyelik Bitiş Tarihi
- 18-12-2024
Merhaba.Aşağıdaki kod ile textboxlara girdiğim metinleri sayfadaki ilgili hücrelere açıklama olarak ekliyorum.Ancak şöyle bir sorun var textboxlardan herhangi biri boşsa kod hata veriyor.Bunun için kodların uygun yerine şart koyarak textboxlardan herhangi biri boş olsa bile diğer dolu olan textboxlardaki metinleri kayıt etsin istiyorum.Yardımcı olabilirseniz sevinirim.
Private Sub CommandButton4_Click()
trh = CDate(TextBox4)
ara = TextBox3
deg = TextBox19
deg1 = TextBox20
deg2 = TextBox21
deg3 = TextBox22
Set c = [A:A].Find(ara, , xlValues, xlWhole)
If Not c Is Nothing Then
Adr = c.Address
If Cells(c.Row, "C") = trh Then
Cells(c.Row, "A").ClearComments
Cells(c.Row, "A").AddComment
Cells(c.Row, "A").Comment.Text Text:=""
Cells(c.Row, "A").Comment.Text Text:=deg
Cells(c.Row, "B").ClearComments
Cells(c.Row, "B").AddComment
Cells(c.Row, "B").Comment.Text Text:=""
Cells(c.Row, "B").Comment.Text Text:=deg1
Cells(c.Row, "C").ClearComments
Cells(c.Row, "C").AddComment
Cells(c.Row, "C").Comment.Text Text:=""
Cells(c.Row, "C").Comment.Text Text:=deg2
Cells(c.Row, "D").ClearComments
Cells(c.Row, "D").AddComment
Cells(c.Row, "D").Comment.Text Text:=""
Cells(c.Row, "D").Comment.Text Text:=deg3
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:
end sub
Private Sub CommandButton4_Click()
trh = CDate(TextBox4)
ara = TextBox3
deg = TextBox19
deg1 = TextBox20
deg2 = TextBox21
deg3 = TextBox22
Set c = [A:A].Find(ara, , xlValues, xlWhole)
If Not c Is Nothing Then
Adr = c.Address
If Cells(c.Row, "C") = trh Then
Cells(c.Row, "A").ClearComments
Cells(c.Row, "A").AddComment
Cells(c.Row, "A").Comment.Text Text:=""
Cells(c.Row, "A").Comment.Text Text:=deg
Cells(c.Row, "B").ClearComments
Cells(c.Row, "B").AddComment
Cells(c.Row, "B").Comment.Text Text:=""
Cells(c.Row, "B").Comment.Text Text:=deg1
Cells(c.Row, "C").ClearComments
Cells(c.Row, "C").AddComment
Cells(c.Row, "C").Comment.Text Text:=""
Cells(c.Row, "C").Comment.Text Text:=deg2
Cells(c.Row, "D").ClearComments
Cells(c.Row, "D").AddComment
Cells(c.Row, "D").Comment.Text Text:=""
Cells(c.Row, "D").Comment.Text Text:=deg3
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:
end sub