Soru Bir combobox'taki verinin değişimi ile diğer textboxlardaki verinin değişmesi

Katılım
9 Aralık 2018
Mesajlar
363
Excel Vers. ve Dili
Excel 2019 - 32 bit TR
Altın Üyelik Bitiş Tarihi
10-06-2024
Merhabalar

bir combobox'taki değerin diğer textbox'lardaki değerleri dozimetri isimli bir worksheet'ten veri alarak değiştirmesine çalışıyorum.

PHP:
Private sub cmbkursayi_change()
    select case cmbkursayi
        case "1"
            tbDOZtoplam.value = Worksheets("kimlik").range("F2")
        case "2"
            tbDOZtoplam.value = Worksheets("kimlik").range("F3")
    end select
end sub

1'i seçersem, F2
2'yi seçersem F3
gibi sıralı seçenekleri sıralamaya çalışıyorum.

combobox olduğu için 1-8 arası değerleri .additem ile ekledim.
nasıl bağlayabilirim?
 
Katılım
9 Aralık 2018
Mesajlar
363
Excel Vers. ve Dili
Excel 2019 - 32 bit TR
Altın Üyelik Bitiş Tarihi
10-06-2024
PHP:
Private Sub cmbkursayi_change()
    Select Case cmbkursayi
        Case "1"
            Me.tbDOZtoplam.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("F2").Value)
            Me.tbDOZ.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("N2").Value)
            Me.tbDOZtg.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("R2").Value)
            Me.tbACs.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("G2").Value)
        Case "2"
            Me.tbDOZtoplam.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("F3").Value)
            Me.tbDOZ.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("N3").Value)
            Me.tbDOZtg.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("R3").Value)
            Me.tbACs.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("G3").Value)
        Case "3"
            Me.tbDOZtoplam.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("F4").Value)
            Me.tbDOZ.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("N4").Value)
            Me.tbDOZtg.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("R4").Value)
            Me.tbACs.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("G4").Value)
        Case "4"
            Me.tbDOZtoplam.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("F5").Value)
            Me.tbDOZ.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("N5").Value)
            Me.tbDOZtg.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("R5").Value)
            Me.tbACs.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("G5").Value)
        Case "5"
            Me.tbDOZtoplam.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("F6").Value)
            Me.tbDOZ.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("N6").Value)
            Me.tbDOZtg.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("R6").Value)
            Me.tbACs.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("G6").Value)
        Case "6"
            Me.tbDOZtoplam.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("F7").Value)
            Me.tbDOZ.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("N7").Value)
            Me.tbDOZtg.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("R7").Value)
            Me.tbACs.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("G7").Value)
        Case "7"
            Me.tbDOZtoplam.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("F8").Value)
            Me.tbDOZ.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("N8").Value)
            Me.tbDOZtg.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("R8").Value)
            Me.tbACs.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("G8").Value)
        Case "8"
            Me.tbDOZtoplam.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("F9").Value)
            Me.tbDOZ.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("N9").Value)
            Me.tbDOZtg.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("R9").Value)
            Me.tbACs.Text = CStr(ThisWorkbook.Sheets("dozimetri").Range("G9").Value)
    End Select
End Sub
Bu şekilde bir kod hazırladım.
hücreleri 0.00 olarak formatlamayı başaramadım.
 

Trilenium

Destek Ekibi
Destek Ekibi
Katılım
16 Eylül 2008
Mesajlar
1,290
Excel Vers. ve Dili
Microsoft Office 2019 English
Örnek

Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("F2").Value,"0.00"))
 
Katılım
9 Aralık 2018
Mesajlar
363
Excel Vers. ve Dili
Excel 2019 - 32 bit TR
Altın Üyelik Bitiş Tarihi
10-06-2024
PHP:
Private Sub cmbkursayi_change()
    Select Case cmbkursayi
        Case "1"
            Me.tbDOZtoplam.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("F2").Value),"0.00")
            Me.tbDOZ.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("N2").Value),"0.00")
            Me.tbDOZtg.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("R2").Value),"0.00")
            Me.tbACs.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("G2").Value),"0.00")
        Case "2"
            Me.tbDOZtoplam.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("F3").Value),"0.00")
            Me.tbDOZ.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("N3").Value),"0.00")
            Me.tbDOZtg.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("R3").Value),"0.00")
            Me.tbACs.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("G3").Value),"0.00")
        Case "3"
            Me.tbDOZtoplam.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("F4").Value),"0.00")
            Me.tbDOZ.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("N4").Value),"0.00")
            Me.tbDOZtg.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("R4").Value),"0.00")
            Me.tbACs.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("G4").Value),"0.00")
        Case "4"
            Me.tbDOZtoplam.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("F5").Value),"0.00")
            Me.tbDOZ.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("N5").Value),"0.00")
            Me.tbDOZtg.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("R5").Value),"0.00")
            Me.tbACs.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("G5").Value),"0.00")
        Case "5"
            Me.tbDOZtoplam.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("F6").Value),"0.00")
            Me.tbDOZ.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("N6").Value),"0.00")
            Me.tbDOZtg.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("R6").Value),"0.00")
            Me.tbACs.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("G6").Value),"0.00")
        Case "6"
            Me.tbDOZtoplam.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("F7").Value),"0.00")
            Me.tbDOZ.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("N7").Value),"0.00")
            Me.tbDOZtg.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("R7").Value),"0.00")
            Me.tbACs.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("G7").Value),"0.00")
        Case "7"
            Me.tbDOZtoplam.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("F8").Value),"0.00")
            Me.tbDOZ.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("N8").Value),"0.00")
            Me.tbDOZtg.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("R8").Value),"0.00")
            Me.tbACs.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("G8").Value),"0.00")
        Case "8"
            Me.tbDOZtoplam.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("F9").Value),"0.00")
            Me.tbDOZ.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("N9").Value),"0.00")
            Me.tbDOZtg.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("R9").Value),"0.00")
            Me.tbACs.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("G9").Value),"0.00")
    End Select
End Sub
Kodu bu şekilde düzenledim. Eline sağlık çalışıyor.

peki bu değerin 100 katını yazması mümkün mü

Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("G9").Value),"0.00") * 100 gibi
 
Katılım
31 Aralık 2014
Mesajlar
1,845
Excel Vers. ve Dili
Excel 2010
Merhaba
Aşağıdaki gibi denermisiniz?
Kodlarınız döngü ile daha kısa olacaktır
Kod:
Private Sub cmbkursayi_change()
Dim a
On Error Resume Next
For a = 1 To 8
If cmbkursayi = a Then
    Me.tbDOZtoplam.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("F" & a + 1).Value * 100), "0.00")
    Me.tbDOZ.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("N" & a + 1).Value * 100), "0.00")
    Me.tbDOZtg.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("R" & a + 1).Value * 100), "0.00")
    Me.tbACs.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("G" & a + 1).Value * 100), "0.00")
Exit For
End If
Next
End Sub
 
Katılım
9 Aralık 2018
Mesajlar
363
Excel Vers. ve Dili
Excel 2019 - 32 bit TR
Altın Üyelik Bitiş Tarihi
10-06-2024
Sadece tbACs için 100 katı uygulacaktım. kaldırınca tüm kod çalışmadı.

PHP:
Private Sub cmbkursayi_change()
    Select Case cmbkursayi
        Case "1"
            Me.tbDOZtoplam.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("F2").Value), "0.00")
            Me.tbDOZ.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("N2").Value), "0.00")
            Me.tbDOZtg.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("R2").Value), "0.00")
            Me.tbACs.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("G2").Value * 100), "0.00")
        Case "2"
            Me.tbDOZtoplam.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("F3").Value), "0.00")
            Me.tbDOZ.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("N3").Value), "0.00")
            Me.tbDOZtg.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("R3").Value), "0.00")
            Me.tbACs.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("G3").Value * 100), "0.00")
        Case "3"
            Me.tbDOZtoplam.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("F4").Value), "0.00")
            Me.tbDOZ.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("N4").Value), "0.00")
            Me.tbDOZtg.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("R4").Value), "0.00")
            Me.tbACs.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("G4").Value * 100), "0.00")
        Case "4"
            Me.tbDOZtoplam.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("F5").Value), "0.00")
            Me.tbDOZ.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("N5").Value), "0.00")
            Me.tbDOZtg.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("R5").Value), "0.00")
            Me.tbACs.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("G5").Value * 100), "0.00")
        Case "5"
            Me.tbDOZtoplam.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("F6").Value), "0.00")
            Me.tbDOZ.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("N6").Value), "0.00")
            Me.tbDOZtg.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("R6").Value), "0.00")
            Me.tbACs.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("G6").Value * 100), "0.00")
        Case "6"
            Me.tbDOZtoplam.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("F7").Value), "0.00")
            Me.tbDOZ.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("N7").Value), "0.00")
            Me.tbDOZtg.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("R7").Value), "0.00")
            Me.tbACs.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("G7").Value * 100), "0.00")
        Case "7"
            Me.tbDOZtoplam.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("F8").Value), "0.00")
            Me.tbDOZ.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("N8").Value), "0.00")
            Me.tbDOZtg.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("R8").Value), "0.00")
            Me.tbACs.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("G8").Value * 100), "0.00")
        Case "8"
            Me.tbDOZtoplam.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("F9").Value), "0.00")
            Me.tbDOZ.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("N9").Value), "0.00")
            Me.tbDOZtg.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("R9").Value), "0.00")
            Me.tbACs.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("G9").Value * 100), "0.00")
    End Select
End Sub
bu şekle çevirince çalıştı ama sizin kısaltılmış hali çalışsa tabii ki çok daha güzel olurdu.

PHP:
Private Sub cmbkursayi_change()
Dim a
On Error Resume Next
For a = 1 To 8
If cmbkursayi = a Then
    Me.tbDOZtoplam.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("F" & a + 1).Value), "0.00")
    Me.tbDOZ.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("N" & a + 1).Value), "0.00")
    Me.tbDOZtg.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("R" & a + 1).Value), "0.00")
    Me.tbACs.Text = Format(CStr(ThisWorkbook.Sheets("dozimetri").Range("G" & a + 1).Value * 100), "0.00")
Exit For
End If
Next
End Sub
şöyle denedim.
 
Katılım
31 Aralık 2014
Mesajlar
1,845
Excel Vers. ve Dili
Excel 2010
Merhaba
Döngülü kodda;
If cmbkursayi = a Then satırını aşağıdaki gibi değiştirip deneyelim
If cmbkursayi.Text = CStr(a) Then
 
Katılım
9 Aralık 2018
Mesajlar
363
Excel Vers. ve Dili
Excel 2019 - 32 bit TR
Altın Üyelik Bitiş Tarihi
10-06-2024
çalıştı.
 
Üst