• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

Spinbutton ile textboxda değer değiştirme

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.2022 - 2032 arası sayıları Textbox1 de göstermek ve spinbutton down ve up olayını kullanarak bu aralıktaki sayıları arttırmak veya azaltmak istiyorum.Yardımcı olursanız sevinirim.
 
Katılım
7 Mart 2022
Mesajlar
9
Excel Vers. ve Dili
365 - Türkçe
Altın Üyelik Bitiş Tarihi
07-03-2023
Merhaba.
İsterseniz MsgBox uyarılarını silebilir ya da değiştirebilirsiniz.

C#:
Private Sub SpinButton1_SpinDown()
On Error Resume Next
    If Me.TextBox1.Value = 2022 Then
        MsgBox "2022 'den Az Olamaz"
        Exit Sub
    End If
    Me.TextBox1 = Me.TextBox1 - 1
End Sub

Private Sub SpinButton1_SpinUp()
On Error Resume Next
    If Me.TextBox1.Value = 2032 Then
        MsgBox "2032 'den Çok Olamaz"
        Exit Sub
    End If
    Me.TextBox1 = Me.TextBox1 + 1
End Sub

Private Sub UserForm_Initialize()
    Me.TextBox1.Value = "2022"
End Sub
 

Ekli dosyalar

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
Textbox1 userformda değil Sayfada.Bu durumda kodu nereye yazmalıyım?
 
Katılım
7 Mart 2022
Mesajlar
9
Excel Vers. ve Dili
365 - Türkçe
Altın Üyelik Bitiş Tarihi
07-03-2023
Bu kısma yazabilirsiniz:

234787

C#:
Private Sub SpinButton1_SpinDown()
On Error Resume Next
    If Me.TextBox1.Value = 2022 Then
        MsgBox "2022 'den Az Olamaz"
        Exit Sub
    End If
    Me.TextBox1 = Me.TextBox1 - 1
End Sub

Private Sub SpinButton1_SpinUp()
On Error Resume Next
    If Me.TextBox1.Value = 2032 Then
        MsgBox "2032 'den Çok Olamaz"
        Exit Sub
    End If
    Me.TextBox1 = Me.TextBox1 + 1
End Sub

Private Sub Worksheet_Activate()
Me.TextBox1.Value = "2022"
End Sub
 

Ekli dosyalar

Üst