• DİKKAT

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

Sub or Function not defined

Katılım
25 Aralık 2019
Mesajlar
3
Excel Vers. ve Dili
2014
Fonksiyonu yazdım ama çalışmadı "sub or Funktion not defined" uyarısı çıktı. Kodu bu şekilde yazdım.


Sub Makro1()

For i = 1 To 21

a(i) = sayfa1.Cells(i, 3)
b(i) = sayfa1.Cells(i, 10)
c(i) = sayfa1.Cells(i, 6)
d(i) = sayfa1.Cells(i, 7)
e(i) = sayfa1.Cells(i, 8)
f(i) = sayfa1.Cells(i, 9)

Next:

x = InputBox("Bitte geben Sie den Artikelcode ein.")

Do Until x = 0

For i = 1 To 21

If x = a(i) Then

MsgBox ("Das Produkt wird verfügbar sein.")
Z = ınputbox("Bitte geben Sie der Bestellungsmenge ein.")

If b(i) = "kampanya" Then

If f(i) <= Z Then
g = d(i) * e(i)
netto_preis = d(i) - g
gesamt_preis = netto_preis * Z
MsgBox gesamt_preis

Else
netto_preis = c(i)
gesamt_preis = netto_preis * Z
MsgBox gesamt_preis

End If

Else
netto_preis = c(i)
tutar = netto_preis * Z
MsgBox gesamt_preis

End If

Next

x = InputBox("Wenn Sie eine verschiedene Produkte kaufen würden, geben Sie den Artikelcoden ein. Anderfalls geben Sie 0 ein.")

Loop


End Sub
 
Merhaba,
a, b, c, d, e, f değerleriniz dizi zannediyorum ama tanımlama yapılmamış. Bu dizileri kodlarınızın en başına Dim a(1 To 21) şeklinde satır ilavesiyle tanımlayabilirsiniz.
Diğer kısımda da End if ifadelerinden birisi eksik gibi...
İyi çalışmalar...
 
Sub Makro1()

Dim a(1 To 21)

For i = 1 To 21

a(i) = sayfa1.Cells(i, 3)
b(i) = sayfa1.Cells(i, 10)
c(i) = sayfa1.Cells(i, 6)
d(i) = sayfa1.Cells(i, 7)
e(i) = sayfa1.Cells(i, 8)
f(i) = sayfa1.Cells(i, 9)

Next:

x = InputBox("Bitte geben Sie den Artikelcode ein.")

Do Until x = 0

For i = 1 To 21

If x = a(i) Then

MsgBox ("Das Produkt wird verfügbar sein.")
Z = ınputbox("Bitte geben Sie der Bestellungsmenge ein.")

If b(i) = "kampanya" Then

If f(i) <= Z Then
g = d(i) * e(i)
netto_preis = d(i) - g
gesamt_preis = netto_preis * Z
MsgBox gesamt_preis

Else
netto_preis = c(i)
gesamt_preis = netto_preis * Z
MsgBox gesamt_preis

End If

Else
netto_preis = c(i)
tutar = netto_preis * Z
MsgBox gesamt_preis

End If

End If

Next

x = InputBox("Wenn Sie eine verschiedene Produkte kaufen würden, geben Sie den Artikelcoden ein. Anderfalls geben Sie 0 ein.")

Loop

End Sub


Düzelttim dediğiniz gibi hala aynı hatayı alıyorum


Merhaba,
a, b, c, d, e, f değerleriniz dizi zannediyorum ama tanımlama yapılmamış. Bu dizileri kodlarınızın en başına Dim a(1 To 21) şeklinde satır ilavesiyle tanımlayabilirsiniz.
Diğer kısımda da End if ifadelerinden birisi eksik gibi...
İyi çalışmalar...
 
Yukarıda a için yaptığınız işlemin aynısını b, c, d, e, f değerleri için de yapınız.
 
Çok teşekkür ederim yardımınız için ama bu seferde 424 error alıyorum. Kodu bir türlü çalıştıramadım.


Yukarıda a için yaptığınız işlemin aynısını b, c, d, e, f değerleri için de yapınız.
 
Geri
Üst