1

Topic: The strange error

The program worked normally, but now produces error Compile Error Next without For in line

Next i

.

Function óñëîâèå4á (Diapozon As Range) As Long
' äëÿ ñèòóàöèè
Application. Volatile
Dim k As Long, n As Long, i As Long, m As Long
Dim C As Range
k =-2
n = 0
m = 0
For i = Diapozon. Rows. Count To 1 Step-1
Set A C = Diapozon. Rows (I)
If (C.Offset (0,-3).Value <> ËÎÆÜ Or C.Offset (0,-4).Value = ËÎÆÜ Or C.Offset (0,-6).Value <> ËÎÆÜ Or C.Offset (0,-7).Value <> ËÎÆÜ Or C.Value = 0) And k =-2 Then
n = 0
Exit For
End If
If k =-2 Then
k = 0
GoTo Label1
End If
If C.Offset (0,-6).Value <> ËÎÆÜ Then
GoTo Label1
End If
If C.Offset (0,-7).Value <> ËÎÆÜ Then
GoTo Label1
End If
If C.Offset (0,-5).Value = 0 Then
GoTo Label1
End If
If C.Value = 0 Then
GoTo Label1
End If
If C.Offset (0,-5).Value = 1 Then
If C.Value = 2 Then
n = 1
Exit For
Else
n = 0
Exit For
End If
Label1:
Next i
óñëîâèå4á = n
End Function

2

Re: The strange error

Balance If and End If does not converge.

3

Re: The strange error

Horror what.
Here Goto  it is not necessary - look at the operator ElseIf
And conditions can be united in single line through And, instead of to write for each step separate If

4

Re: The strange error

Akina;

5

Re: The strange error

Shocker. Pro;
Yes at me on Goto all programs are based)

6

Re: The strange error

https://yandex.ru/search/? text=goto &clid=2207714&lr=213

7

Re: The strange error

Shocker. Pro;
And as

on error goto errH

smile

8

Re: The strange error

big-duke wrote:

and as

It only on letters GoTo...