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
 

hımmmmmmmm

Destek Ekibi
Destek Ekibi
Katılım
10 Temmuz 2011
Mesajlar
601
Excel Vers. ve Dili
2000-2007-2010-2016
Kod:
         Else: Cells(i, 7) = "kontrol et"
End If

Next i
olacak
 

hamitcan

Uzman
Uzman
Katılım
1 Temmuz 2004
Mesajlar
7,746
Excel Vers. ve Dili
Excel 2019 Türkçe
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"
 
Katılım
20 Aralık 2019
Mesajlar
2
Excel Vers. ve Dili
Excel 2016 Türkçe
Merhaba cevabınız için teşekkür ederim.Ancak çalışmadı.Ruin time error 424 hatası veriyor
 

hamitcan

Uzman
Uzman
Katılım
1 Temmuz 2004
Mesajlar
7,746
Excel Vers. ve Dili
Excel 2019 Türkçe
Dosyanızı eklerseniz daha çabuk cevap bulabilirsiniz.
 
Katılım
31 Aralık 2014
Mesajlar
1,845
Excel Vers. ve Dili
Excel 2010
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
 
Üst