Soru Userformu kapattığımda sayfadaki tüm commandbutton'lar kayboluyor.

seckinb

Altın Üye
Katılım
9 Aralık 2018
Mesajlar
363
Excel Vers. ve Dili
Excel 2019 - 32 bit TR
Userformun değişiklik yapmış olduğu sayfada çeşitli güncellemeler yaptım.


Bu duruma ne sebep oluyor sizce?
Sanırım bir bug'a neden oluyorum.

PHP:
Private Sub cmbTX1_Change()
Sheets("Kimlik").Range("B19") = cmbTX1.Value
End Sub
Private Sub cmbTX2_Change()
Sheets("Kimlik").Range("B20") = cmbTX2.Value
End Sub
Private Sub cmbTX3_Change()
Sheets("Kimlik").Range("B21") = cmbTX3.Value
End Sub
Private Sub cmbTX4_Change()
Sheets("Kimlik").Range("B22") = cmbTX4.Value
End Sub
Private Sub cmbTX5_Change()
Sheets("Kimlik").Range("B23") = cmbTX5.Value
End Sub
Private Sub cmbTX6_Change()
Sheets("Kimlik").Range("B28") = cmbTX6.Value
End Sub
Private Sub cmbTX7_Change()
Sheets("Kimlik").Range("B29") = cmbTX7.Value
End Sub
Private Sub cmbTX8_Change()
Sheets("Kimlik").Range("B30") = cmbTX8.Value
End Sub
Private Sub cmbTX9_Change()
Sheets("Kimlik").Range("B31") = cmbTX9.Value
End Sub
Private Sub cmbTX10_Change()
Sheets("Kimlik").Range("B32") = cmbTX10.Value
End Sub
Private Sub cmbTX11_Change()
Sheets("Kimlik").Range("B33") = cmbTX11.Value
End Sub

Private Sub DTPick4_Change()
'vefat tarihi için burayı kullanıyoruz.
Sheets("Kimlik").Range("I5") = Format(Me.DTPick4().Value, "dd.mm.yyyy")
Me.dt4_show.Text = CDate(ThisWorkbook.Sheets("Kimlik").Range("I5").Value)
End Sub
Private Sub Kapat_Click()
Application.ScreenUpdating = True
Worksheets("Formlar").Select
Hide
End Sub
Private Sub LB1_Change()
'tanı girişi için gerekmektedir
Sheets("Kimlik").Range("C9") = LB1.Value
End Sub
Private Sub LB5_Change()

Sheets("Kimlik").Range("I9") = LB5.Value

Dim ad As String
Dim ResimYolu As String
Dim Resim As Object
Dim Foto As Object

Dim ResimAlani As Range

Set ResimAlani = Sheets("Kimlik").Range("I33")

On Error Resume Next
Application.ScreenUpdating = False
For Each Foto In ActiveSheet.Pictures
    If Not Intersect(Foto.TopLeftCell, ResimAlani) Is Nothing Then
        Foto.Delete
    End If
Next

Set ResimAlani = Nothing

ad = LB5.Value

ResimYolu = ActiveWorkbook.path & "\Resim\" & ad & ".png"

ResimEkle (ResimYolu)
    
End Sub


Sub ResimEkle(dosya As String)

If Dir(dosya) = "" Then Exit Sub

With Sheets("Kimlik").Pictures.Insert(dosya)
.Left = Cells(33, 9).Left
.Top = Cells(33, 9).Top
.ShapeRange.LockAspectRatio = True

End With
End Sub

Private Sub tbHikaye_Change()
Sheets("Kimlik").oyku = tbHikaye.Value
End Sub

Private Sub tbPatoloji_Change()
Sheets("Kimlik").Range("a39") = tbPatoloji.Value
End Sub
Private Sub tbTED1_Change()
Sheets("Kimlik").Range("F19") = tbTED1.Value
End Sub
Private Sub tbTED2_Change()
Sheets("Kimlik").Range("F20") = tbTED2.Value
End Sub
Private Sub tbTED3_Change()
Sheets("Kimlik").Range("F21") = tbTED3.Value
End Sub
Private Sub tbTED4_Change()
Sheets("Kimlik").Range("F22") = tbTED4.Value
End Sub
Private Sub tbTED5_Change()
Sheets("Kimlik").Range("F23") = tbTED5.Value
End Sub
Private Sub tbTED6_Change()
Sheets("Kimlik").Range("F28") = tbTED6.Value
End Sub
Private Sub tbTED7_Change()
Sheets("Kimlik").Range("F29") = tbTED7.Value
End Sub
Private Sub tbTED8_Change()
Sheets("Kimlik").Range("F30") = tbTED8.Value
End Sub
Private Sub tbTED9_Change()
Sheets("Kimlik").Range("F31") = tbTED9.Value
End Sub
Private Sub tbTED10_Change()
Sheets("Kimlik").Range("F32") = tbTED10.Value
End Sub
Private Sub tbTED11_Change()
Sheets("Kimlik").Range("F33") = tbTED11.Value
End Sub

Private Sub UserForm_Activate()
On Error Resume Next

Me.tbPatoloji.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("a39").Value)
Me.tbHikaye.Text = CStr(ThisWorkbook.Sheets("Kimlik").oyku)

Me.cmbTX1.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("B19").Value)
Me.cmbTX2.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("B20").Value)
Me.cmbTX3.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("B21").Value)
Me.cmbTX4.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("B22").Value)
Me.cmbTX5.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("B23").Value)
Me.cmbTX6.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("B28").Value)
Me.cmbTX7.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("B29").Value)
Me.cmbTX8.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("B30").Value)
Me.cmbTX9.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("B31").Value)
Me.cmbTX10.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("B32").Value)
Me.cmbTX11.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("B33").Value)

Me.tbTED1.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("F19").Value)
Me.tbTED2.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("F20").Value)
Me.tbTED3.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("F21").Value)
Me.tbTED4.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("F22").Value)
Me.tbTED5.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("F23").Value)
Me.tbTED6.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("F28").Value)
Me.tbTED7.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("F29").Value)
Me.tbTED8.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("F30").Value)
Me.tbTED9.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("F31").Value)
Me.tbTED10.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("F32").Value)
Me.tbTED11.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("F33").Value)

'vefat için
Me.dt4_show.Text = CDate(ThisWorkbook.Sheets("Kimlik").Range("I5").Value)


End Sub

Private Sub UserForm_Initialize()
On Error Resume Next

Me.tbPatoloji.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("a39").Value)
Me.tbHikaye.Text = CStr(ThisWorkbook.Sheets("Kimlik").oyku)

Me.cmbTX1.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("B19").Value)
Me.cmbTX2.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("B20").Value)
Me.cmbTX3.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("B21").Value)
Me.cmbTX4.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("B22").Value)
Me.cmbTX5.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("B23").Value)
Me.cmbTX6.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("B28").Value)
Me.cmbTX7.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("B29").Value)
Me.cmbTX8.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("B30").Value)
Me.cmbTX9.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("B31").Value)
Me.cmbTX10.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("B32").Value)
Me.cmbTX11.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("B33").Value)

Me.tbTED1.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("F19").Value)
Me.tbTED2.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("F20").Value)
Me.tbTED3.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("F21").Value)
Me.tbTED4.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("F22").Value)
Me.tbTED5.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("F23").Value)
Me.tbTED6.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("F28").Value)
Me.tbTED7.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("F29").Value)
Me.tbTED8.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("F30").Value)
Me.tbTED9.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("F31").Value)
Me.tbTED10.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("F32").Value)
Me.tbTED11.Text = CStr(ThisWorkbook.Sheets("Kimlik").Range("F33").Value)

With Me.cmbTX1
    .AddItem "Radikal Prostatektomi"
    .AddItem "TUR-P"
    .AddItem "Pelvik lenf nodu diseksiyonu"
End With

With Me.cmbTX2
    .AddItem "Radikal Prostatektomi"
    .AddItem "TUR-P"
    .AddItem "Pelvik lenf nodu diseksiyonu"
End With

With Me.cmbTX3
    .AddItem "Hormonoterapi (Lucrin, Eligard, Zoladex, Casodex)"
    .AddItem "Bilateral Orşiektomi"
End With

'kemoterapi seçeneklerini buraya ekleyeceğim
    Dim eskitedavi(), X As Byte
    
    eskitedavi = Array("Dosetaksel (TAXOTERE)", "Kabazitaksel (JEVTANA®)", "Abirateron (ZYTIGA®)", "Enzalutamid (XTANDI®)", "Sipuleucel-T (PRONGE®)")
    
    For X = 4 To 7
        Me.Controls("cmbTX" & X).List = eskitedavi
    Next

'RADYOTERAPİ SEÇENEKLERİNİ EKLİYORUM

With Me.cmbTX8
    .AddItem "Prostat Radyoterapisi"
    .AddItem "Palyatif RT - Lenf Nodu"
    .AddItem "Palyatif RT - Kemik - LOMBER"
    .AddItem "Palyatif RT - Kemik - PELVİK"
    .AddItem "Palyatif RT - Kemik - TORAKAL"
    .AddItem "Palyatif RT - Kemik - SERVİKAL"
End With

'RADYOTERAPİ SEÇENEKLERİNİ EKLİYORUM

With Me.cmbTX9
    .AddItem "Prostat Radyoterapisi"
    .AddItem "Palyatif RT - Lenf Nodu"
    .AddItem "Palyatif RT - Kemik - LOMBER"
    .AddItem "Palyatif RT - Kemik - PELVİK"
    .AddItem "Palyatif RT - Kemik - TORAKAL"
    .AddItem "Palyatif RT - Kemik - SERVİKAL"
End With

'RADYOTERAPİ SEÇENEKLERİNİ EKLİYORUM

With Me.cmbTX10
    .AddItem "Prostat Radyoterapisi"
    .AddItem "Palyatif RT - Lenf Nodu"
    .AddItem "Palyatif RT - Kemik - LOMBER"
    .AddItem "Palyatif RT - Kemik - PELVİK"
    .AddItem "Palyatif RT - Kemik - TORAKAL"
    .AddItem "Palyatif RT - Kemik - SERVİKAL"
End With

'RADYONUKLID SEÇENEKLERİ

With Me.cmbTX11
    .AddItem "Lu177 PSMA"
    .AddItem "Ac225 PSMA"
    .AddItem "Ra223 diklorid (XOFIGO®)"
End With

With Me.LB1
'TANI İÇİN SEÇENEKLER SUNUYOR
    .AddItem "Gleason_3+3_PCa"
    .AddItem "Gleason_3+4_PCa"
    .AddItem "Gleason_4+3_PCa"
    .AddItem "Gleason_4+4_PCa"
    .AddItem "Gleason_4+5_PCa"
    .AddItem "Gleason_5+4_PCa"
    .AddItem "Gleason_5+5_PCa"

End With

With Me.LB5
'evre İÇİN SEÇENEKLER SUNUYOR
    .AddItem "N1"
    .AddItem "N2"
    .AddItem "M1a"
    .AddItem "M1b (tek)"
    .AddItem "M1b (oligo)"
    .AddItem "M1b (Dissemine)"
    .AddItem "M1b (Diffüz)"
    .AddItem "M1c (Organ)"
End With


'ex tarihi yükleme
Me.dt4_show.Text = CDate(ThisWorkbook.Sheets("Kimlik").Range("I5").Value)

'EVRE iki yönlü
Me.LB5.Value = ThisWorkbook.Sheets("Kimlik").Range("I9").Value

'GS iki yönlü yapmak
Me.LB1.Value = ThisWorkbook.Sheets("Kimlik").Range("C9").Value

End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Application.ScreenUpdating = True
Worksheets("Formlar").Select
End Sub
 

Muzaffer Ali

Destek Ekibi
Destek Ekibi
Katılım
5 Haziran 2006
Mesajlar
5,803
Excel Vers. ve Dili
2019 Türkçe
Merhaba.

Forma yeni bir buton ekleyin ve end protokolü ile uygulamaya son verin.
Yani şöyle

Kod:
Private Sub CommandButton1_Click()
    End
End Sub
Eğer aynı şey olmazsa form kapatılırken çalışan kodlar butonları siliyor demektir. O kodları bulup kontrol edin.
Eğer aynı şey olursa dosyanızı paylaşın kontrol edelim.
 
Üst