irfancantr
Altın Üye
- Katılım
- 18 Haziran 2007
- Mesajlar
- 625
- Excel Vers. ve Dili
- Excel 365 - İmngilizce
İyi akşamlar,
Aşağıda gördüğünüz gibi uzunca bir kod hazırladım.
Bu örnekte bulunan kod gibi kısaltma şansımız var mı?
[/CODE]
Aşağıda gördüğünüz gibi uzunca bir kod hazırladım.
Kod:
If CheckBox1 Then Cells(SATIR, "CN") = ("+") Else Cells(SATIR, "CN") = ("")
If CheckBox2 Then Cells(SATIR, "CO") = ("+") Else Cells(SATIR, "CO") = ("")
If CheckBox3 Then Cells(SATIR, "CP") = ("+") Else Cells(SATIR, "CP") = ("")
If CheckBox4 Then Cells(SATIR, "CQ") = ("+") Else Cells(SATIR, "CQ") = ("")
If CheckBox5 Then Cells(SATIR, "CR") = ("+") Else Cells(SATIR, "CR") = ("")
.............
........
....
If CheckBox70 Then Cells(SATIR, "FE") = ("+") Else Cells(SATIR, "FE") = ("")
Bu örnekte bulunan kod gibi kısaltma şansımız var mı?
Kod:
[CODE][COLOR="Red"][B]Uzun kod.....[/B][/COLOR]
Cells(SATIR, "I") = TextBox1.Text
Cells(SATIR, "J") = TextBox2.Text
Cells(SATIR, "K") = TextBox3.Text
Cells(SATIR, "L") = TextBox4.Text
..........
......
....
Cells(SATIR, "BP") = TextBox60.Value
Kod:
[COLOR="red"][B]Kısaltılmış hali kod......[/B][/COLOR]
Dim ts, kaplan, SATIR
SATIR = Range("A" & Rows.Count).End(xlUp).Row + 1
kaplan = 9
For ts = 1 To 60
Cells(SATIR, kaplan) = Controls("Textbox" & ts)
kaplan = kaplan + 1
Next
