Diyelim elimizde userform1 de belirli satırlar arasında bir kod bloğu var 20 satırlık ve siz bu 20 satırlık kodu her açacağınız yeni userform sayfasında kullanacaksınız bunu açacağınız her userform sayfasında kullanmanın pratik yolu nedir acaba ? özetle normalde asp de olan incude mantığı var mı vba da daha çok çok yeniyim lütfen sorduğum soru tuhafsa kusuruma bakmayın. Bir kod bloğu yazdım for döngüleri kullanmadağım için koda satır sayım fazla olduğundan bana procedure too large hatası alıyorum. Kodları azaltmam lazım call ile denedim olmadı veya ben beceremedim.
Aşağıdaki bloğu daha kısa yazmanın yolu var mıdır ? bu bloğu her sayfada nasıl kullanabilir hale geitrebilirim ?
Private Sub CommandButton2_Click()
If ComboBox10.Value = "1" Then Sheets("1").Range("e34" & Bos_Satir).Value = Sheets("1").[e34] + TextBox7.Value
If ComboBox10.Value = "2" Then Sheets("2").Range("e34" & Bos_Satir).Value = Sheets("2").[e34] + TextBox7.Value
If ComboBox10.Value = "3" Then Sheets("3").Range("e34" & Bos_Satir).Value = Sheets("3").[e34] + TextBox7.Value
If ComboBox10.Value = "4" Then Sheets("4").Range("e34" & Bos_Satir).Value = Sheets("4").[e34] + TextBox7.Value
If ComboBox10.Value = "5" Then Sheets("5").Range("e34" & Bos_Satir).Value = Sheets("5").[e34] + TextBox7.Value
If ComboBox10.Value = "6" Then Sheets("6").Range("e34" & Bos_Satir).Value = Sheets("6").[e34] + TextBox7.Value
If ComboBox10.Value = "7" Then Sheets("7").Range("e34" & Bos_Satir).Value = Sheets("7").[e34] + TextBox7.Value
If ComboBox10.Value = "8" Then Sheets("8").Range("e34" & Bos_Satir).Value = Sheets("8").[e34] + TextBox7.Value
If ComboBox10.Value = "9" Then Sheets("9").Range("e34" & Bos_Satir).Value = Sheets("9").[e34] + TextBox7.Value
If ComboBox10.Value = "10" Then Sheets("10").Range("e34" & Bos_Satir).Value = Sheets("10").[e34] + TextBox7.Value
If ComboBox10.Value = "11" Then Sheets("11").Range("e34" & Bos_Satir).Value = Sheets("11").[e34] + TextBox7.Value
If ComboBox10.Value = "12" Then Sheets("12").Range("e34" & Bos_Satir).Value = Sheets("12").[e34] + TextBox7.Value
If ComboBox10.Value = "13" Then Sheets("13").Range("e34" & Bos_Satir).Value = Sheets("13").[e34] + TextBox7.Value
If ComboBox10.Value = "14" Then Sheets("14").Range("e34" & Bos_Satir).Value = Sheets("14").[e34] + TextBox7.Value
If ComboBox10.Value = "15" Then Sheets("15").Range("e34" & Bos_Satir).Value = Sheets("15").[e34] + TextBox7.Value
If ComboBox10.Value = "16" Then Sheets("16").Range("e34" & Bos_Satir).Value = Sheets("16").[e34] + TextBox7.Value
If ComboBox10.Value = "17" Then Sheets("17").Range("e34" & Bos_Satir).Value = Sheets("17").[e34] + TextBox7.Value
If ComboBox10.Value = "18" Then Sheets("18").Range("e34" & Bos_Satir).Value = Sheets("18").[e34] + TextBox7.Value
If ComboBox10.Value = "19" Then Sheets("19").Range("e34" & Bos_Satir).Value = Sheets("19").[e34] + TextBox7.Value
If ComboBox10.Value = "20" Then Sheets("20").Range("e34" & Bos_Satir).Value = Sheets("20").[e34] + TextBox7.Value
If ComboBox10.Value = "21" Then Sheets("21").Range("e34" & Bos_Satir).Value = Sheets("21").[e34] + TextBox7.Value
If ComboBox10.Value = "22" Then Sheets("22").Range("e34" & Bos_Satir).Value = Sheets("22").[e34] + TextBox7.Value
If ComboBox10.Value = "23" Then Sheets("23").Range("e34" & Bos_Satir).Value = Sheets("23").[e34] + TextBox7.Value
If ComboBox10.Value = "24" Then Sheets("24").Range("e34" & Bos_Satir).Value = Sheets("24").[e34] + TextBox7.Value
If ComboBox10.Value = "25" Then Sheets("25").Range("e34" & Bos_Satir).Value = Sheets("25").[e34] + TextBox7.Value
If ComboBox10.Value = "26" Then Sheets("26").Range("e34" & Bos_Satir).Value = Sheets("26").[e34] + TextBox7.Value
If ComboBox10.Value = "27" Then Sheets("27").Range("e34" & Bos_Satir).Value = Sheets("27").[e34] + TextBox7.Value
If ComboBox10.Value = "28" Then Sheets("28").Range("e34" & Bos_Satir).Value = Sheets("28").[e34] + TextBox7.Value
If ComboBox10.Value = "29" Then Sheets("29").Range("e34" & Bos_Satir).Value = Sheets("29").[e34] + TextBox7.Value
If ComboBox10.Value = "30" Then Sheets("30").Range("e34" & Bos_Satir).Value = Sheets("30").[e34] + TextBox7.Value
If ComboBox10.Value = "31" Then Sheets("31").Range("e34" & Bos_Satir).Value = Sheets("31").[e34] + TextBox7.Value
Aşağıdaki bloğu daha kısa yazmanın yolu var mıdır ? bu bloğu her sayfada nasıl kullanabilir hale geitrebilirim ?
Private Sub CommandButton2_Click()
If ComboBox10.Value = "1" Then Sheets("1").Range("e34" & Bos_Satir).Value = Sheets("1").[e34] + TextBox7.Value
If ComboBox10.Value = "2" Then Sheets("2").Range("e34" & Bos_Satir).Value = Sheets("2").[e34] + TextBox7.Value
If ComboBox10.Value = "3" Then Sheets("3").Range("e34" & Bos_Satir).Value = Sheets("3").[e34] + TextBox7.Value
If ComboBox10.Value = "4" Then Sheets("4").Range("e34" & Bos_Satir).Value = Sheets("4").[e34] + TextBox7.Value
If ComboBox10.Value = "5" Then Sheets("5").Range("e34" & Bos_Satir).Value = Sheets("5").[e34] + TextBox7.Value
If ComboBox10.Value = "6" Then Sheets("6").Range("e34" & Bos_Satir).Value = Sheets("6").[e34] + TextBox7.Value
If ComboBox10.Value = "7" Then Sheets("7").Range("e34" & Bos_Satir).Value = Sheets("7").[e34] + TextBox7.Value
If ComboBox10.Value = "8" Then Sheets("8").Range("e34" & Bos_Satir).Value = Sheets("8").[e34] + TextBox7.Value
If ComboBox10.Value = "9" Then Sheets("9").Range("e34" & Bos_Satir).Value = Sheets("9").[e34] + TextBox7.Value
If ComboBox10.Value = "10" Then Sheets("10").Range("e34" & Bos_Satir).Value = Sheets("10").[e34] + TextBox7.Value
If ComboBox10.Value = "11" Then Sheets("11").Range("e34" & Bos_Satir).Value = Sheets("11").[e34] + TextBox7.Value
If ComboBox10.Value = "12" Then Sheets("12").Range("e34" & Bos_Satir).Value = Sheets("12").[e34] + TextBox7.Value
If ComboBox10.Value = "13" Then Sheets("13").Range("e34" & Bos_Satir).Value = Sheets("13").[e34] + TextBox7.Value
If ComboBox10.Value = "14" Then Sheets("14").Range("e34" & Bos_Satir).Value = Sheets("14").[e34] + TextBox7.Value
If ComboBox10.Value = "15" Then Sheets("15").Range("e34" & Bos_Satir).Value = Sheets("15").[e34] + TextBox7.Value
If ComboBox10.Value = "16" Then Sheets("16").Range("e34" & Bos_Satir).Value = Sheets("16").[e34] + TextBox7.Value
If ComboBox10.Value = "17" Then Sheets("17").Range("e34" & Bos_Satir).Value = Sheets("17").[e34] + TextBox7.Value
If ComboBox10.Value = "18" Then Sheets("18").Range("e34" & Bos_Satir).Value = Sheets("18").[e34] + TextBox7.Value
If ComboBox10.Value = "19" Then Sheets("19").Range("e34" & Bos_Satir).Value = Sheets("19").[e34] + TextBox7.Value
If ComboBox10.Value = "20" Then Sheets("20").Range("e34" & Bos_Satir).Value = Sheets("20").[e34] + TextBox7.Value
If ComboBox10.Value = "21" Then Sheets("21").Range("e34" & Bos_Satir).Value = Sheets("21").[e34] + TextBox7.Value
If ComboBox10.Value = "22" Then Sheets("22").Range("e34" & Bos_Satir).Value = Sheets("22").[e34] + TextBox7.Value
If ComboBox10.Value = "23" Then Sheets("23").Range("e34" & Bos_Satir).Value = Sheets("23").[e34] + TextBox7.Value
If ComboBox10.Value = "24" Then Sheets("24").Range("e34" & Bos_Satir).Value = Sheets("24").[e34] + TextBox7.Value
If ComboBox10.Value = "25" Then Sheets("25").Range("e34" & Bos_Satir).Value = Sheets("25").[e34] + TextBox7.Value
If ComboBox10.Value = "26" Then Sheets("26").Range("e34" & Bos_Satir).Value = Sheets("26").[e34] + TextBox7.Value
If ComboBox10.Value = "27" Then Sheets("27").Range("e34" & Bos_Satir).Value = Sheets("27").[e34] + TextBox7.Value
If ComboBox10.Value = "28" Then Sheets("28").Range("e34" & Bos_Satir).Value = Sheets("28").[e34] + TextBox7.Value
If ComboBox10.Value = "29" Then Sheets("29").Range("e34" & Bos_Satir).Value = Sheets("29").[e34] + TextBox7.Value
If ComboBox10.Value = "30" Then Sheets("30").Range("e34" & Bos_Satir).Value = Sheets("30").[e34] + TextBox7.Value
If ComboBox10.Value = "31" Then Sheets("31").Range("e34" & Bos_Satir).Value = Sheets("31").[e34] + TextBox7.Value