For next döngüsü hakkında

Katılım
3 Mart 2005
Mesajlar
609
Excel Vers. ve Dili
2010 Excel-Türkçe
Altın Üyelik Bitiş Tarihi
21/03/2019
Merhaba
bidiğiniz gibi for next döngüsü
For i= 1 to 12
......
next i

seklinde

bu döngüyü ocaktan aralığa kadar seklinde olacak sekilde nasıl olabilir.

For i= ocak to Aralık


.......

next i
 
Katılım
14 Şubat 2006
Mesajlar
3,426
Excel Vers. ve Dili
(Excel 2016 - İngilizce)
Altın Üyelik Bitiş Tarihi
30-11-2022
Sayın metinozlu,

Aşağıdaki kodlar işinize yarayabilir mi?

[vb:1:8ddaab030d]
Sub AA()
Dim ay As Variant
ay = Array("Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık")
For Each kontrol In ay
MsgBox kontrol
Next
End Sub
[/vb:1:8ddaab030d]
 
Katılım
3 Mart 2005
Mesajlar
609
Excel Vers. ve Dili
2010 Excel-Türkçe
Altın Üyelik Bitiş Tarihi
21/03/2019
nesnelerle ilişkilendirmede bir problem çıkmaz ise sanırım işe yarar
cevap için sağol :Dost:
 
Katılım
3 Mart 2005
Mesajlar
609
Excel Vers. ve Dili
2010 Excel-Türkçe
Altın Üyelik Bitiş Tarihi
21/03/2019
ben aşağıdaki kodu kısaltmaya çalışıyorum.Array yöntemini bu koda nasıl adapte edebilirim.
Yardımlarınızı bekliyorum.

Private Sub CommandButton14_Click()
'Sheets("kontrol").Select
Dim m As Integer
For m = 284 To 331
'Sheets("kontrol").Cells(m, 1).Value = Controls("textBox" & m).Name
Controls("textBox" & m).Value = ""

Next m
Worksheets("data").Visible = True
Sheets("data").Select
Range("es2").Select
Dim i As Integer
For i = 2 To 50

Cells(i, "es").Select

If Sheets("data").Cells(i, "es").Value = "Ocak" Then
UserForm1.TextBox284.Value = ActiveCell.Offset(0, 22).Value
UserForm1.TextBox285.Value = ActiveCell.Offset(0, 14).Value
UserForm1.TextBox308.Value = ActiveCell.Offset(0, 25).Value
UserForm1.TextBox309.Value = ActiveCell.Offset(0, 17).Value

Else
If Sheets("data").Cells(i, "es").Value = "Şubat" Then
UserForm1.TextBox286.Value = ActiveCell.Offset(0, 22).Value
UserForm1.TextBox287.Value = ActiveCell.Offset(0, 14).Value
UserForm1.TextBox310.Value = ActiveCell.Offset(0, 25).Value
UserForm1.TextBox311.Value = ActiveCell.Offset(0, 17).Value

Else

If Sheets("data").Cells(i, "es").Value = "Mart" Then
UserForm1.TextBox288.Value = ActiveCell.Offset(0, 22).Value
UserForm1.TextBox289.Value = ActiveCell.Offset(0, 14).Value
UserForm1.TextBox312.Value = ActiveCell.Offset(0, 25).Value
UserForm1.TextBox313.Value = ActiveCell.Offset(0, 17).Value

Else

If Sheets("data").Cells(i, "es").Value = "Nisan" Then
UserForm1.TextBox290.Value = ActiveCell.Offset(0, 22).Value
UserForm1.TextBox291.Value = ActiveCell.Offset(0, 14).Value
UserForm1.TextBox314.Value = ActiveCell.Offset(0, 25).Value
UserForm1.TextBox315.Value = ActiveCell.Offset(0, 17).Value

Else

If Sheets("data").Cells(i, "es").Value = "Mayıs" Then
UserForm1.TextBox292.Value = ActiveCell.Offset(0, 22).Value
UserForm1.TextBox293.Value = ActiveCell.Offset(0, 14).Value
UserForm1.TextBox316.Value = ActiveCell.Offset(0, 25).Value
UserForm1.TextBox317.Value = ActiveCell.Offset(0, 17).Value

Else

If Sheets("data").Cells(i, "es").Value = "Haziran" Then
UserForm1.TextBox294.Value = ActiveCell.Offset(0, 22).Value
UserForm1.TextBox295.Value = ActiveCell.Offset(0, 14).Value
UserForm1.TextBox318.Value = ActiveCell.Offset(0, 25).Value
UserForm1.TextBox319.Value = ActiveCell.Offset(0, 17).Value

Else

If Sheets("data").Cells(i, "es").Value = "Temmuz" Then
UserForm1.TextBox296.Value = ActiveCell.Offset(0, 22).Value
UserForm1.TextBox297.Value = ActiveCell.Offset(0, 14).Value
UserForm1.TextBox320.Value = ActiveCell.Offset(0, 25).Value
UserForm1.TextBox321.Value = ActiveCell.Offset(0, 17).Value

Else

If Sheets("data").Cells(i, "es").Value = "Ağustos" Then
UserForm1.TextBox298.Value = ActiveCell.Offset(0, 22).Value
UserForm1.TextBox299.Value = ActiveCell.Offset(0, 14).Value
UserForm1.TextBox322.Value = ActiveCell.Offset(0, 25).Value
UserForm1.TextBox323.Value = ActiveCell.Offset(0, 17).Value

Else

If Sheets("data").Cells(i, "es").Value = "Eylül" Then
UserForm1.TextBox300.Value = ActiveCell.Offset(0, 22).Value
UserForm1.TextBox301.Value = ActiveCell.Offset(0, 14).Value
UserForm1.TextBox324.Value = ActiveCell.Offset(0, 25).Value
UserForm1.TextBox325.Value = ActiveCell.Offset(0, 17).Value

Else

If Sheets("data").Cells(i, "es").Value = "Ekim" Then
UserForm1.TextBox302.Value = ActiveCell.Offset(0, 22).Value
UserForm1.TextBox303.Value = ActiveCell.Offset(0, 14).Value
UserForm1.TextBox326.Value = ActiveCell.Offset(0, 25).Value
UserForm1.TextBox327.Value = ActiveCell.Offset(0, 17).Value

Else

If Sheets("data").Cells(i, "es").Value = "Kasım" Then
UserForm1.TextBox304.Value = ActiveCell.Offset(0, 22).Value
UserForm1.TextBox305.Value = ActiveCell.Offset(0, 12).Value
UserForm1.TextBox328.Value = ActiveCell.Offset(0, 25).Value
UserForm1.TextBox329.Value = ActiveCell.Offset(0, 17).Value

Else

If Sheets("data").Cells(i, "es").Value = "Aralık" Then
UserForm1.TextBox306.Value = ActiveCell.Offset(0, 22).Value
UserForm1.TextBox307.Value = ActiveCell.Offset(0, 14).Value
UserForm1.TextBox330.Value = ActiveCell.Offset(0, 25).Value
UserForm1.TextBox331.Value = ActiveCell.Offset(0, 17).Value

End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If

Next i

End Sub
 

Haluk

𐱅𐰇𐰼𐰚
Katılım
7 Temmuz 2004
Mesajlar
12,323
Excel Vers. ve Dili
64 Bit 2010 - İngilizce
+
Google Sheets
+
JScript
Altın Üyelik Bitiş Tarihi
Size yardımcı olabilmek için kodlardaki dosyayı kendimizin hazırlaması gerekiyor.

UserForm'un üzerine 330 tane TextBox, sayfalar v.s.

Dosyayı ekleyin isterseniz ...
 
Katılım
3 Mart 2005
Mesajlar
609
Excel Vers. ve Dili
2010 Excel-Türkçe
Altın Üyelik Bitiş Tarihi
21/03/2019
dosya ekte (kodlar haketme "Önceki hakedişler" butonunda

yukarıdaki kodların çalışmasında bir problem yok.
daha kısa nasıl yazılabilir onu çözmeye çalıştığım için soruyu gönderdim.
 
Üst