Örnek, Userform uzunluk çevrimi

Katılım
24 Nisan 2005
Mesajlar
3,671
Excel Vers. ve Dili
Office 2016 EN 64 Bit
Altın Üyelik Bitiş Tarihi
25/05/2022
Bir soru üzerine yazmıştım, soru kaybolmuş. Boşa gitmesin : )

Uzunluk çevrimi userform lu örnek çalışma.
Milimetre, Santimetre, Metre ve Kilometre çevrimi. İkinci listbox da seçimler değiştikçe sonuç değişecektir.

Userform a iki listbox, iki textbox ekleyiniz.

http://s4.dosya.tc/server2/z5qqh6/uzunluk_cevrim.zip.html

Kod:
Private Sub ListBox2_Change()
    If ListBox1.Text = "Milimetre" And ListBox2.Text = "Milimetre" Then TextBox2.Text = Val(TextBox1.Text) * 1
    If ListBox1.Text = "Milimetre" And ListBox2.Text = "Santimetre" Then TextBox2.Text = Val(TextBox1.Text) / 10
    If ListBox1.Text = "Milimetre" And ListBox2.Text = "Metre" Then TextBox2.Text = Val(TextBox1.Text) / 1000
    If ListBox1.Text = "Milimetre" And ListBox2.Text = "Kilometre" Then TextBox2.Text = Val(TextBox1.Text) / 1000000
    
    If ListBox1.Text = "Santimetre" And ListBox2.Text = "Milimetre" Then TextBox2.Text = Val(TextBox1.Text) * 10
    If ListBox1.Text = "Santimetre" And ListBox2.Text = "Santimetre" Then TextBox2.Text = Val(TextBox1.Text) * 1
    If ListBox1.Text = "Santimetre" And ListBox2.Text = "Metre" Then TextBox2.Text = Val(TextBox1.Text) / 100
    If ListBox1.Text = "Santimetre" And ListBox2.Text = "Kilometre" Then TextBox2.Text = Val(TextBox1.Text) / 100000
        
    If ListBox1.Text = "Metre" And ListBox2.Text = "Milimetre" Then TextBox2.Text = Val(TextBox1.Text) * 1000
    If ListBox1.Text = "Metre" And ListBox2.Text = "Santimetre" Then TextBox2.Text = Val(TextBox1.Text) * 100
    If ListBox1.Text = "Metre" And ListBox2.Text = "Metre" Then TextBox2.Text = Val(TextBox1.Text) * 1
    If ListBox1.Text = "Metre" And ListBox2.Text = "Kilometre" Then TextBox2.Text = Val(TextBox1.Text) / 1000
    
    If ListBox1.Text = "Kilometre" And ListBox2.Text = "Milimetre" Then TextBox2.Text = Val(TextBox1.Text) * 1000000
    If ListBox1.Text = "Kilometre" And ListBox2.Text = "Santimetre" Then TextBox2.Text = Val(TextBox1.Text) * 100000
    If ListBox1.Text = "Kilometre" And ListBox2.Text = "Metre" Then TextBox2.Text = Val(TextBox1.Text) * 1000
    If ListBox1.Text = "Kilometre" And ListBox2.Text = "Kilometre" Then TextBox2.Text = Val(TextBox1.Text) * 1
End Sub

Private Sub UserForm_Initialize()
ListBox1.Clear
ListBox1.AddItem "Milimetre"
ListBox1.AddItem "Santimetre"
ListBox1.AddItem "Metre"
ListBox1.AddItem "Kilometre"

ListBox2.Clear
ListBox2.AddItem "Milimetre"
ListBox2.AddItem "Santimetre"
ListBox2.AddItem "Metre"
ListBox2.AddItem "Kilometre"

End Sub
 
Üst