Sayın Korhan Ayhan beyin bir çalışması vardı. Butonlara makro ile isim tanımlama. Ama ben bunu kendi userformuma uyarlayamadım. Usrformumda 3 adet texbox ve 1 adet de commandbutton var.
Burada neyi yanlış yaptım?
Kod:
Private Sub CommandButton1_Click()
Dim sat As Long
If TextBox1.Value = "" Then
MsgBox "Mesaj açıklaması Giriniz.", , "Pencerenin ismi"
Exit Sub
End If
sat = ActiveWorkbook.Sheets("Sayfa2").Cells(65536, "A").End(xlUp).Row + 1
ActiveWorkbook.Sheets("Sayfa2").Cells(sat, "A").Value = TextBox1.Text ' Adı
ActiveWorkbook.Sheets("Sayfa2").Cells(sat, "B").Value = TextBox2.Text ' Soyadı
ActiveWorkbook.Sheets("Sayfa2").Cells(sat, "C").Value = TextBox3.Text ' Adresi
Temizle
End Sub
Private Sub Temizle()
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
End Sub
Burada neyi yanlış yaptım?
Kod:
Private Sub UserForm_Initialize()
Dim X As Byte
Dim Buton_Adı() As Variant
Buton_Adı = Array("KAYDET")
For X = 1 To UBound(Buton_Adı())
With UserForm1
.Controls("CommandButton" & X).Caption = Buton_Adı(X)
.Controls("CommandButton" & X).Font.Size = 12
.Controls("CommandButton" & X).Font.Bold = True
.Controls("CommandButton" & X).ForeColor = vbRed
End With
Next
End Sub
