Ошибка VBA "For without Next"
Для экселя нужно сделать небольшую программку. Но в коде на End sub выдает ошибку For without Next. В чем может быть проблема вот код:
{General}
Option Explicit
Private Type ZAP
nomer As Integer
raion As String
firma As String
vid As String
Product As String
Price As Currency
vipusk As Integer
realize As Integer
End Type
{button}
Private Sub CommandButton1_Click()
Dim N As Integer
Dim mas() As ZAP
Dim S As Range
Dim zvid As String
Dim min As Integer
Dim I As Integer
Dim J As Integer
Dim L As Integer
Dim T As Integer
Set S = Range("baza")
N = S.Rows.Count - 1
ReDim mas(1 To N) As ZAP
For I = 1 To N
mas(I).nomer = I
mas(I).raion = Cells(I + 1, 2)
mas(I).firma = Cells(I + 1, 3)
mas(I).vid = Cells(I + 1, 4)
mas(I).Product = Cells(I + 1, 5)
mas(I).Price = Cells(I + 1, 6)
mas(I).vipusk = Cells(I + 1, 7)
mas(I).realize = Cells(I + 1,
Next I
zvid = InputBox("vvedite vid prodikcii")
min = 1
For I = 1 To N
If zvid = mas(I).vid And mas(I).Price > min Then min = mas(I).Price
L = 2
T = 0
For J = 1 To N
If zvid = mas(I).vid And mas(I).Price = min Then
L = L + 1
T = T + 1
Cells(L, 10) = T
Cells(L, 11) = mas(I).raion
Cells(L, 12) = mas(I).firma
Cells(L, 13) = mas(I).vid
Cells(L, 14) = mas(I).Product
Cells(L, 15) = mas(I).Price
Cells(L, 16) = mas(I).vipusk
Cells(L, 17) = mas(I).realize
End If
Next J
End Sub