• DİKKAT

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

Next without for hatası

Katılım
20 Aralık 2019
Mesajlar
2
Excel Vers. ve Dili
Excel 2016 Türkçe
Merhaba Arkadaşlar

Aşağıdaki kodu yazmaya uğraşıyorum.Kodu test edemedim çünkü "Compile Error :Next without for" hatası alıyorum.Bu hatayı nasıl giderebilirim?Ayrıca dizi yazmaya çalıştım onda da hatam olabilir.Ona da bakabilirseniz memnun olurum. Yardımcı olabileceklere şimdiden teşekkür ederim.

Private Sub Worksheet_Change(ByVal Target As Range)


sonsatir = Cells(Rows.Count, "B").End(xlUp).Row

For i = 2 To sonsatir


If Target.Column = 2 Then

If Cells(i, 3) = 8 And IsNumeric(Application.Match(Range("F" & Target.Row).Value, Array(9, 10), 0)) Then

Cells(i, 7) = Cells(i, 2) * 1.5 * 600 / 9000 * 372 / 1000
End If

If Cells(i, 3) = 8 And IsNumeric(Application.Match(Range("F" & Target.Row).Value, Array(12, 89), 0)) Then

Cells(i, 7) = Cells(i, 2) * 1.5 * 600 / 9000 * 372 / 1000
End If

If Cells(i, 3) = 8 And IsNumeric(Application.Match(Range("F" & Target.Row).Value, Array(24, 46, 47, 63, 86, 93), 0)) Then

Cells(i, 7) = Cells(i, 2) * 1.5 * 600 / 9000 * 372 / 1000
End If

Else: Cells(i, 7) = "kontrol et"


Next i



End Sub
 
Kod:
         Else: Cells(i, 7) = "kontrol et"
End If

Next i

olacak
 
Kodun sonunda End If yok. Muhtemelen buna kızıyor.
Kod:
If Cells(i, 3) = 8 And IsNumeric(Application.Match(Range("F" & Target.Row).Value, Array(24, 46, 47, 63, 86, 93), 0)) Then

Cells(i, 7) = Cells(i, 2) * 1.5 * 600 / 9000 * 372 / 1000
End If

Else: Cells(i, 7) = "kontrol et"
 
Merhaba cevabınız için teşekkür ederim.Ancak çalışmadı.Ruin time error 424 hatası veriyor
 
Dosyanızı eklerseniz daha çabuk cevap bulabilirsiniz.
 
Merhaba

Aşağıdaki gibi deneyin

Kod:
Private Sub Worksheet_Change(ByVal Target As Range)


sonsatir = Cells(Rows.Count, "B").End(xlUp).Row
For i = 2 To sonsatir

If Target.Column = 2 Then
Cells(i, 7) = "kontrol et"

If Cells(i, 3) = 8 And IsNumeric(Application.Match(Range("F" & Target.Row).Value, Array(9, 10), 0)) Then

Cells(i, 7) = Cells(i, 2) * 1.5 * 600 / 9000 * 372 / 1000
End If

If Cells(i, 3) = 8 And IsNumeric(Application.Match(Range("F" & Target.Row).Value, Array(12, 89), 0)) Then

Cells(i, 7) = Cells(i, 2) * 1.5 * 600 / 9000 * 372 / 1000
End If

If Cells(i, 3) = 8 And IsNumeric(Application.Match(Range("F" & Target.Row).Value, Array(24, 46, 47, 63, 86, 93), 0)) Then

Cells(i, 7) = Cells(i, 2) * 1.5 * 600 / 9000 * 372 / 1000
End If
End If
Next i
End Sub
 
Geri
Üst