• DİKKAT

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

Eğer Formulünü Kodla Yazarak Hesaplatma

Katılım
5 Ekim 2007
Mesajlar
84
Excel Vers. ve Dili
excel 2002
merhaba arkadaşlar, eğer frmulü kullanarak hesaplatma yaptırıyorum. Ancak ben bunu kodla yapmak istiyorum. kodla yazdığım bir çalışma var onu buraya ekliyorum ancak eksik birşeyler var sanırım yanlış hesaplama yapıyor
If TextBox53.Text = "" Then

MsgBox "Lütfen Önce T.C.M.B Kurlarını Alınız.....", , "Selçuk Derki.."
Exit Sub
End If


If TextBox55.Text = "Euro" Then

TextBox68.Text = TextBox14.Text
End If

If TextBox56.Text = "Usd" Then

TextBox69.Value = Val(TextBox15.Text) / Val(TextBox53.Text)
End If

If TextBox57.Text = "Usd" Then

TextBox70.Value = Val(TextBox16.Text) / Val(TextBox53.Text)
End If


If TextBox58.Text = "Usd" Then

TextBox71.Value = Val(TextBox17.Text) / Val(TextBox53.Text)
End If

If TextBox59.Text = "Usd" Then

TextBox72.Value = Val(TextBox18.Text) / Val(TextBox53.Text)
End If


If TextBox60.Text = "Usd" Then

TextBox73.Value = Val(TextBox19.Text) / Val(TextBox53.Text)
End If


If TextBox61.Text = "Usd" Then

TextBox74.Value = Val(TextBox20.Text) / Val(TextBox53.Text)
End If

If TextBox62.Text = "Usd" Then

TextBox75.Value = Val(TextBox21.Text) / Val(TextBox53.Text)
End If


If TextBox63.Text = "Usd" Then

TextBox76.Value = Val(TextBox22.Text) / Val(TextBox53.Text)
End If

If TextBox64.Text = "Usd" Then

TextBox77.Value = Val(TextBox23.Text) / Val(TextBox53.Text)
End If


If TextBox65.Text = "Usd" Then

TextBox78.Value = Val(TextBox24.Text) / Val(TextBox53.Text)
End If


If TextBox66.Text = "Usd" Then

TextBox79.Value = Val(TextBox25.Text) / Val(TextBox53.Text)
End If


If TextBox67.Text = "Usd" Then

TextBox80.Value = Val(TextBox26.Text) / Val(TextBox53.Text)
End If















If TextBox55.Text = "Usd" Then

TextBox68.Value = Val(TextBox14.Text) / Val(TextBox53.Text)


End If
If TextBox56.Text = "Euro" Then
TextBox69.Text = TextBox15.Text


End If

If TextBox57.Text = "Euro" Then
TextBox70.Text = TextBox16.Text
End If
If TextBox58.Text = "Euro" Then
TextBox71.Text = TextBox17.Text
End If
If TextBox59.Text = "Euro" Then
TextBox72.Text = TextBox18.Text
End If
If TextBox60.Text = "Euro" Then
TextBox73.Text = TextBox19.Text
End If
If TextBox61.Text = "Euro" Then
TextBox74.Text = TextBox20.Text
End If

If TextBox62.Text = "Euro" Then
TextBox75.Text = TextBox21.Text
End If
If TextBox63.Text = "Euro" Then
TextBox76.Text = TextBox22.Text
End If

If TextBox64.Text = "Euro" Then
TextBox77.Text = TextBox23.Text
End If
If TextBox65.Text = "Euro" Then
TextBox78.Text = TextBox24.Text
End If

If TextBox66.Text = "Euro" Then
TextBox79.Text = TextBox25.Text
End If
If TextBox67.Text = "Euro" Then
TextBox80.Text = TextBox26.Text
End If



TextBox81.Value = Val(TextBox68.Text) * Val(TextBox1.Text) / 1000
TextBox82.Value = Val(TextBox69.Text) * Val(TextBox2.Text) / 1000
TextBox83.Value = Val(TextBox70.Text) * Val(TextBox3.Text) / 1000
TextBox84.Value = Val(TextBox71.Text) * Val(TextBox4.Text) / 1000
TextBox85.Value = Val(TextBox72.Text) * Val(TextBox5.Text) / 1000
TextBox86.Value = Val(TextBox73.Text) * Val(TextBox6.Text) / 1000
TextBox87.Value = Val(TextBox74.Text) * Val(TextBox7.Text) / 1000
TextBox88.Value = Val(TextBox75.Text) * Val(TextBox8.Text) / 1000
TextBox89.Value = Val(TextBox76.Text) * Val(TextBox9.Text) / 1000
TextBox90.Value = Val(TextBox77.Text) * Val(TextBox10.Text) / 1000
TextBox91.Value = Val(TextBox78.Text) * Val(TextBox11.Text) / 1000
TextBox92.Value = Val(TextBox79.Text) * Val(TextBox12.Text) / 1000
TextBox93.Value = Val(TextBox80.Text) * Val(TextBox13.Text) / 1000


TextBox94.Text = Val(TextBox81.Text) + Val(TextBox82.Text) + Val(TextBox83.Text) + Val(TextBox84.Text) + Val(TextBox85.Text) + Val(TextBox86.Text) + Val(TextBox87.Text) + Val(TextBox88.Text) + Val(TextBox89.Text) + Val(TextBox90.Text) + Val(TextBox91.Text) + Val(TextBox92.Text) + Val(TextBox93.Text)
End Sub
 
merhaba arkadaşlar, eğer frmulü kullanarak hesaplatma yaptırıyorum. Ancak ben bunu kodla yapmak istiyorum. kodla yazdığım bir çalışma var onu buraya ekliyorum ancak eksik birşeyler var sanırım yanlış hesaplama yapıyor

Gördüğüm kadari ile 4 işlem yapıyorsunuz hatalar bu dört işlemlerde ise textbox.text uzantılarını textbox.value ile dğiştirin ve Val(textbox.text) kısmınıda Cdbl(Textbox.value) olarak değiştirn birde oyle deneyin ama hatayı dosya uzeerinden görmeden işlem yapmak biraz zor.
 
Sayin Huseyin tsk ederim . sanirim bu kod isimi gorecek gibi deneme yapiyorum ancak bir hata veriyor. soyleki textboxlara zorunlu hesaplama yapiyor ancak diyelimki textboxtlarda deger olmadigi zaman bos gecsin hesap yapmasin bunu nasil saglayabilirim degisiklikleri ekliyorum
TextBox81.Value = CDbl(TextBox68.Value) * CDbl(TextBox1.Value) / 1000
TextBox82.Value = CDbl(TextBox69.Value) * CDbl(TextBox2.Value) / 1000
TextBox83.Value = CDbl(TextBox70.Value) * CDbl(TextBox3.Value) / 1000
TextBox84.Value = CDbl(TextBox71.Value) * CDbl(TextBox4.Value) / 1000
TextBox85.Value = CDbl(TextBox72.Value) * CDbl(TextBox5.Value) / 1000
TextBox86.Value = CDbl(TextBox73.Value) * CDbl(TextBox6.Value) / 1000
TextBox87.Value = CDbl(TextBox74.Value) * CDbl(TextBox7.Value) / 1000
TextBox88.Value = CDbl(TextBox75.Value) * CDbl(TextBox8.Value) / 1000
TextBox89.Value = CDbl(TextBox76.Value) * CDbl(TextBox9.Value) / 1000
TextBox90.Value = CDbl(TextBox77.Value) * CDbl(TextBox10.Value) / 1000
TextBox91.Value = CDbl(TextBox78.Value) * CDbl(TextBox11.Value) / 1000
TextBox92.Value = CDbl(TextBox79.Value) * CDbl(TextBox12.Value) / 1000
TextBox93.Value = CDbl(TextBox80.Value) * CDbl(TextBox13.Value) / 1000


TextBox94.Text = CDbl(TextBox81.Value) + CDbl(TextBox82.Value) + CDbl(TextBox83.Value) + CDbl(TextBox84.Value) + CDbl(TextBox85.Value) + CDbl(TextBox86.Value) + CDbl(TextBox87.Value) + CDbl(TextBox88.Value) + CDbl(TextBox89.Value) + CDbl(TextBox90.Value) + CDbl(TextBox91.Value) + CDbl(TextBox92.Value) + CDbl(TextBox93.Value)
End Sub

bunlarin hepsi bazen kullanilmiyor sadece aktif olan textboxtlarda islem yaptirmak istiyorum umarim anlatabilmisimdir
 
Sayin Huseyin tsk ederim . sanirim bu kod isimi gorecek gibi deneme yapiyorum ancak bir hata veriyor. soyleki textboxlara zorunlu hesaplama yapiyor ancak diyelimki textboxtlarda deger olmadigi zaman bos gecsin hesap yapmasin bunu nasil saglayabilirim degisiklikleri ekliyorum

bunlarin hepsi bazen kullanilmiyor sadece aktif olan textboxtlarda islem yaptirmak istiyorum umarim anlatabilmisimdir

islem yoksa evet hata verir. hata vermemesi değer yoksa 0 yap demeniz gerekiyor. Bunu bütün textboxlara nasıl uygulanır formulun başında ekteki kodu kullanırsanız sanırım işlem çözülür.


For i = 1 To 200 'textbox kaçtane varsa 200 ona göre değiştirin.

if Controls("Textbox"&i).Value = "" then
Controls("Textbox"&i).Value = 0
End if
Next

bu kodla bilgi olmayan textboxlara 0 değerini atamış oluruz.
 
Hocam sonuca az kaldı gibi. Ama yine hata veriyor ben son halini ekliyorum . İlave olarak textboxların bazılarındada metinsel değer var "Usd" gibi ben textbox kontrollerini yazarken For i 1 to 93 şeklinde yaptım burdaki işlem olmayan her textboxu sıfır görsün diğerlerini hesaplasın şeklinde
Private Sub CommandButton7_Click()
If TextBox53.Text = "" Then

MsgBox "Lütfen Önce T.C.M.B Kurlarını Alınız.....", , "Selçuk Derki.."
Exit Sub
End If


If TextBox55.Text = "Euro" Then

TextBox68.Text = TextBox14.Text
End If

If TextBox56.Text = "Usd" Then

TextBox69.Value = CDbl(TextBox15.Value) / CDbl(TextBox53.Value)
End If

If TextBox57.Text = "Usd" Then

TextBox70.Value = CDbl(TextBox16.Value) / CDbl(TextBox53.Value)
End If


If TextBox58.Text = "Usd" Then

TextBox71.Value = CDbl(TextBox17.Value) / CDbl(TextBox53.Value)
End If

If TextBox59.Text = "Usd" Then

TextBox72.Value = CDbl(TextBox18.Value) / CDbl(TextBox53.Value)
End If


If TextBox60.Text = "Usd" Then

TextBox73.Value = CDbl(TextBox19.Value) / CDbl(TextBox53.Value)
End If


If TextBox61.Text = "Usd" Then

TextBox74.Value = CDbl(TextBox20.Value) / CDbl(TextBox53.Value)
End If

If TextBox62.Text = "Usd" Then

TextBox75.Value = CDbl(TextBox21.Value) / CDbl(TextBox53.Value)
End If


If TextBox63.Text = "Usd" Then

TextBox76.Value = CDbl(TextBox22.Value) / CDbl(TextBox53.Value)
End If

If TextBox64.Text = "Usd" Then

TextBox77.Value = CDbl(TextBox23.Value) / CDbl(TextBox53.Value)
End If


If TextBox65.Text = "Usd" Then

TextBox78.Value = CDbl(TextBox24.Value) / CDbl(TextBox53.Value)
End If


If TextBox66.Text = "Usd" Then

TextBox79.Value = CDbl(TextBox25.Value) / CDbl(TextBox53.Value)
End If


If TextBox67.Text = "Usd" Then

TextBox80.Value = CDbl(TextBox26.Value) / CDbl(TextBox53.Value)
End If















If TextBox55.Text = "Usd" Then

TextBox68.Value = CDbl(TextBox14.Value) / CDbl(TextBox53.Value)


End If
If TextBox56.Text = "Euro" Then
TextBox69.Text = TextBox15.Text


End If

If TextBox57.Text = "Euro" Then
TextBox70.Text = TextBox16.Text
End If
If TextBox58.Text = "Euro" Then
TextBox71.Text = TextBox17.Text
End If
If TextBox59.Text = "Euro" Then
TextBox72.Text = TextBox18.Text
End If
If TextBox60.Text = "Euro" Then
TextBox73.Text = TextBox19.Text
End If
If TextBox61.Text = "Euro" Then
TextBox74.Text = TextBox20.Text
End If

If TextBox62.Text = "Euro" Then
TextBox75.Text = TextBox21.Text
End If
If TextBox63.Text = "Euro" Then
TextBox76.Text = TextBox22.Text
End If

If TextBox64.Text = "Euro" Then
TextBox77.Text = TextBox23.Text
End If
If TextBox65.Text = "Euro" Then
TextBox78.Text = TextBox24.Text
End If

If TextBox66.Text = "Euro" Then
TextBox79.Text = TextBox25.Text
End If
If TextBox67.Text = "Euro" Then
TextBox80.Text = TextBox26.Text
End If

For i = 1 To 93 'textbox kaçtane varsa 200 ona göre değiştirin.

If Controls("Textbox" & i).Value = "" Then
Controls("Textbox" & i).Value = 0
End If
Next


TextBox81.Value = CDbl(TextBox68.Value) * CDbl(TextBox1.Value) / 1000
TextBox82.Value = CDbl(TextBox69.Value) * CDbl(TextBox2.Value) / 1000
TextBox83.Value = CDbl(TextBox70.Value) * CDbl(TextBox3.Value) / 1000
TextBox84.Value = CDbl(TextBox71.Value) * CDbl(TextBox4.Value) / 1000
TextBox85.Value = CDbl(TextBox72.Value) * CDbl(TextBox5.Value) / 1000
TextBox86.Value = CDbl(TextBox73.Value) * CDbl(TextBox6.Value) / 1000
TextBox87.Value = CDbl(TextBox74.Value) * CDbl(TextBox7.Value) / 1000
TextBox88.Value = CDbl(TextBox75.Value) * CDbl(TextBox8.Value) / 1000
TextBox89.Value = CDbl(TextBox76.Value) * CDbl(TextBox9.Value) / 1000
TextBox90.Value = CDbl(TextBox77.Value) * CDbl(TextBox10.Value) / 1000
TextBox91.Value = CDbl(TextBox78.Value) * CDbl(TextBox11.Value) / 1000
TextBox92.Value = CDbl(TextBox79.Value) * CDbl(TextBox12.Value) / 1000
TextBox93.Value = CDbl(TextBox80.Value) * CDbl(TextBox13.Value) / 1000


TextBox94.Value = CDbl(TextBox81.Value) + CDbl(TextBox82.Value) + CDbl(TextBox83.Value) + CDbl(TextBox84.Value) + CDbl(TextBox85.Value) + CDbl(TextBox86.Value) + CDbl(TextBox87.Value) + CDbl(TextBox88.Value) + CDbl(TextBox89.Value) + CDbl(TextBox90.Value) + CDbl(TextBox91.Value) + CDbl(TextBox92.Value) + CDbl(TextBox93.Value)
End Sub
 
Hocam sonuca az kaldı gibi. Ama yine hata veriyor ben son halini ekliyorum . İlave olarak textboxların bazılarındada metinsel değer var "Usd" gibi ben textbox kontrollerini yazarken For i 1 to 93 şeklinde yaptım burdaki işlem olmayan her textboxu sıfır görsün diğerlerini hesaplasın şeklinde

Hatayı nerde veriyor tam cozemedim ama for i=1 to 93 döngüsünü en başa msgbox altına yerleştirin. Metinsel ifadelerde olsa sonucta boş olanları 0 yapıcak.
 
hocam o şekilde yaptım ama yine hata veriyor alttaki hesaplamada hatayı veriyor Dbdl Kısmında boş geçmiyor ilk boşa gelen textboxta hata veriyor dosyayı ekliycem ancak uzantısı 2 gb çok uzun sadeleştirip bir dosya koyacağım
 
hocam o şekilde yaptım ama yine hata veriyor alttaki hesaplamada hatayı veriyor Dbdl Kısmında boş geçmiyor ilk boşa gelen textboxta hata veriyor dosyayı ekliycem ancak uzantısı 2 gb çok uzun sadeleştirip bir dosya koyacağım


Oradki Kodu Değiştirelim.

TextBox94.Value = CDbl(TextBox81.Value) + CDbl(TextBox82.Value) + CDbl(TextBox83.Value) + CDbl(TextBox84.Value) + CDbl(TextBox85.Value) + CDbl(TextBox86.Value) + CDbl(TextBox87.Value) + CDbl(TextBox88.Value) + CDbl(TextBox89.Value) + CDbl(TextBox90.Value) + CDbl(TextBox91.Value) + CDbl(TextBox92.Value) + CDbl(TextBox93.Value)

Kod:
TextBox94.Value =0

For r = 81 to 93
if Controls("Textbox"& r).value ="" then
else
TextBox94.Value =TextBox94.Value +Controls("Textbox"& r).value
end if
next r
 
yok hocam olmuyor bir yerde hata veriyor anlamadım ben size bir dosya ekleyerek bunu anlatmaya çalışacağım
 
tamam hocam tşk ederim kolay gelsin

Sanırım Bişeylere Ulaştım:)

Commandbutton7 nin bütün kodlarını silin ve ketekileri yerleştirin.

Kod:
Private Sub CommandButton7_Click()
If TextBox53.Value = "" Then
MsgBox "Lütfen Önce T.C.M.B Kurlarını Alınız.....", , "Selçuk Derki.."
Exit Sub
End If


TextBox94.Value = 0 * 1
For i = 1 To 13
If Controls("TextBox" & i + 54).Value = "Euro" Then
Controls("TextBox" & i + 67).Value = Format(Controls("TextBox" & i + 13).Value, "##.###,00")
ElseIf Controls("TextBox" & i + 54).Value = "Usd" Then
Controls("TextBox" & i + 67).Value = Format((Controls("TextBox" & i + 13).Value * 1) / (TextBox53.Value * 1), "##.###,00")
ElseIf Controls("TextBox" & i + 54).Value = "TL" Then
Controls("TextBox" & i + 67).Value = Format((Controls("TextBox" & i + 13).Value * 1) * (TextBox51.Value * 1), "##.###,00")
End If

If Controls("TextBox" & i + 67).Value = "" Or Controls("TextBox" & i).Value = "" Then
Else
Controls("TextBox" & i + 80).Value = Format((Controls("TextBox" & i + 67).Value * 1) * (Controls("TextBox" & i).Value * 1) / 1000, "##.###,00")
End If

If Controls("Textbox" & i + 80).Value = "" Then
Else
TextBox94.Value = Format(TextBox94.Value * 1 + Controls("Textbox" & i + 80).Value * 1, "##.###,00")
End If
Next
End Sub


Birde Command8 butonunun altındaki kodları ektekiler ile değiştirin. tamamını silmeyin ekteki kodların aynısı var orda Formatlı yazanları ekilerinin yerine koyun.


Kod:
TextBox52.Value = Format(Worksheets("kur").Range("D4"), "##.###,####")
TextBox51.Value = Format(Worksheets("kur").Range("D5"), "##.###,####")
TextBox53.Value = Format(Worksheets("kur").Range("D6"), "##.###,########")
 
hocam süpersin ellerin dert görmesin ancak bir ricam var şimdi textboxtaki sonuçlar eğer 1 'in altında ise ,00568 şeklinde yazıyor başında 0,00568 gibi yazması mümkün mü ??
 
Hocam Merhaba, verdiğiniz işlemi yaptım ama olmadı 7255555.505 gibi sonuçlar çıkıyor
 
Dosya Ekte..

Dosya Yuklu olduğu için kaldırdım.
 
Son düzenleme:
Hocam ne diyebilirimki tek kelimeyle müthişsiniz. Emekleriniz için Tşkler Allah razı olsun. İyi çalışmalar, kolay gelsin
 
Geri
Üst