• DİKKAT

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

Döngüyü ters çevirmek yada OptionButtona sayfadan veri almak

Hakan ERDOST

Destek Ekibi
Destek Ekibi
Katılım
12 Eylül 2004
Mesajlar
885
Excel Vers. ve Dili
Excel 2019 Türkçe (Ev)
Excel 2013 Türkçe (Okul)
32 adet optiobutton daki verileri ve formdaki verileri;
Kod:
Private Sub CommandButton1_Click()
On Error Resume Next

Set KayıtSayfa = Sheets("Okuma_Yazma_Değerlendirme")
On Error Resume Next

If Trim(TextBox3) = "" Then
Uyarı = MsgBox("İsim Giriniz...", 56, "İsim Uyarı")
Exit Sub
End If


KayıtSıra = WorksheetFunction.CountA(Range("A1:A65000")) + 1

Cells(KayıtSıra, 1).Value = KayıtSıra - 1
Cells(KayıtSıra, 3).Value = TextBox3
Cells(KayıtSıra, 2).Value = ComboBox1
Cells(KayıtSıra, 4).Value = TextBox2


For i = 1 To 32 Step 4
  Sıra = Sıra + 1
  '-----------------------------------------------
  Sec = 0: Deg = 0
  For k = i To i + 3
         s = s + 1
         If Controls("OptionButton" & Trim(k)) = True Then
         On Sec GoTo A, B, C, D
A:            Deg = 1:  GoTo TAMAM
B:            Deg = 2:  GoTo TAMAM
C:            Deg = 3:  GoTo TAMAM
D:            Deg = 4:  GoTo TAMAM

         End If
  Next k
  '-----------------------------------------------
TAMAM:
If Deg <> 0 Then
  DegT = DegT + Deg
  Cells(KayıtSıra, Sıra + 4).Value = Deg
End If
Next i
   Cells(KayıtSıra, 13).Value = DegT

    End Sub
Kodu ile sayfaya aktarıyorum.Sayfadan Listboxa aldığım verilerimi (ListBox1 UserForm31 üzerinde) ListBoxun doubleclick olayı ile açılacak Userform16 üzerindeki textbox ve optonbuttonlara veriyi alarak güncellemek istiyorum. Ancak kaydet döngüsünü forma veri alırken kurgulayamadım.TextBoxlarda sorun yok, döngü dışında olduğu için :)
Bu da click kodum
Kod:
Private Sub ListBox1_Click()
Dim KayıtSayfa As Worksheet
Set KayıtSayfa = Sheets("Okuma_Yazma_Değerlendirme")
  
 Load UserForm16
UserForm16.TextBox1 = UserForm31.ListBox1.List(UserForm31.ListBox1.ListIndex, 0)
UserForm16.ComboBox1 = UserForm31.ListBox1.List(UserForm31.ListBox1.ListIndex, 1)
UserForm16.TextBox3 = UserForm31.ListBox1.List(UserForm31.ListBox1.ListIndex, 2)
UserForm16.TextBox4 = UserForm31.ListBox1.List(UserForm31.ListBox1.ListIndex, 3)
'
' 
Döngü buraya gelecek
'


UserForm16.Show
End Sub
 
Son düzenleme:
Merhaba;
Sorunuz net olmasada (OptionButton'a veri mi alacaksınız? yada OptionButton'u işaretli mi yapmak istiyorsunuz?) örnek size fikir verecektir.
İnceleyin.
İyi çalışmalar.
 

Ekli dosyalar

Merhaba;
Sorunuz net olmasada (OptionButton'a veri mi alacaksınız? yada OptionButton'u işaretli mi yapmak istiyorsunuz?) örnek size fikir verecektir.
İnceleyin.
İyi çalışmalar.
Teşekkürler muygun, uzunca da olsa aşağıdaki kod ile yardımcı textboxlarla çözdüm (Önce textboxa alıp oradan optionbuttona aldım, kulağı biraz uzun yoldan gösterdik ama neyse...:)). Bu döngü işine çalışmam lazım.Tekrar teşekkürler.
Kod:
Private Sub ListBox1_Click()
UserForm16.TextBox1 = ListBox1.List(ListBox1.ListIndex, 0)
UserForm16.ComboBox1 = ListBox1.List(ListBox1.ListIndex, 1)
UserForm16.TextBox3 = ListBox1.List(ListBox1.ListIndex, 2)
UserForm16.TextBox4 = ListBox1.List(ListBox1.ListIndex, 3)
UserForm16.TextBox5 = ListBox1.List(ListBox1.ListIndex, 4)
UserForm16.TextBox6 = ListBox1.List(ListBox1.ListIndex, 5)
UserForm16.TextBox7 = ListBox1.List(ListBox1.ListIndex, 6)
UserForm16.TextBox8 = ListBox1.List(ListBox1.ListIndex, 7)
UserForm16.TextBox9 = ListBox1.List(ListBox1.ListIndex, 8)
UserForm16.TextBox10 = ListBox1.List(ListBox1.ListIndex, 9)
UserForm16.TextBox11 = ListBox1.List(ListBox1.ListIndex, 10)
UserForm16.TextBox12 = ListBox1.List(ListBox1.ListIndex, 11)

If TextBox5.Value = "1" Then
OptionButton1 = True
End If
If TextBox5.Value = "2" Then
OptionButton2 = True
End If
If TextBox5.Value = "3" Then
OptionButton3 = True
End If
If TextBox5.Value = "4" Then
OptionButton4 = True
End If
        If TextBox6.Value = "1" Then
        OptionButton5 = True
        End If
        If TextBox6.Value = "2" Then
        OptionButton6 = True
        End If
        If TextBox6.Value = "3" Then
        OptionButton7 = True
        End If
        If TextBox6.Value = "4" Then
        OptionButton8 = True
        End If
       
       
If TextBox7.Value = "1" Then
OptionButton9 = True
End If
If TextBox7.Value = "2" Then
OptionButton10 = True
End If
If TextBox7.Value = "3" Then
OptionButton11 = True
End If
If TextBox7.Value = "4" Then
OptionButton12 = True
End If

            If TextBox8.Value = "1" Then
            OptionButton13 = True
            End If
            If TextBox8.Value = "2" Then
            OptionButton14 = True
            End If
            If TextBox8.Value = "3" Then
             OptionButton15 = True
            End If
            If TextBox8.Value = "4" Then
            OptionButton16 = True
            End If
If TextBox9.Value = "1" Then
OptionButton17 = True
End If
If TextBox9.Value = "2" Then
OptionButton18 = True
End If
If TextBox9.Value = "3" Then
OptionButton19 = True
End If
If TextBox9.Value = "4" Then
OptionButton20 = True
End If
        If TextBox10.Value = "1" Then
        OptionButton21 = True
        End If
        If TextBox10.Value = "2" Then
        OptionButton22 = True
        End If
        If TextBox10.Value = "3" Then
        OptionButton23 = True
        End If
        If TextBox10.Value = "4" Then
        OptionButton24 = True
        End If
       
       
If TextBox11.Value = "1" Then
OptionButton25 = True
End If
If TextBox11.Value = "2" Then
OptionButton26 = True
End If
If TextBox11.Value = "3" Then
OptionButton27 = True
End If
If TextBox11.Value = "4" Then
OptionButton28 = True
End If

            If TextBox12.Value = "1" Then
            OptionButton29 = True
            End If
            If TextBox12.Value = "2" Then
            OptionButton30 = True
            End If
            If TextBox12.Value = "3" Then
             OptionButton31 = True
            End If
            If TextBox12.Value = "4" Then
            OptionButton32 = True
            End If

End Sub
 
Geri
Üst