Здравствуйте. Наверное, напутала что-то с типами данных.. При выполнении данного макроса возникает ошибка "Else without if" :
Sub Macros()
Dim i As Integer
Dim j As Integer
Dim x As Integer
Dim y As Integer
Dim A As Double
x = ActiveCell.Row
y = ActiveCell.Column
i = x
Do While ((ColorIndex(Cells(i, y))) <> 21)
Cells(i, y + 6).Value = Cells(i, y + 1).Value
Cells(i, y + 1).Formula = "=MID(RC[-1],SEARCH(""??.??.????"",RC[-1],1),10)"
Cells(i, y + 1).NumberFormat = "m/d/yyyy"
Cells(i, y + 2).NumberFormat = "0"
Cells(i, y + 3).NumberFormat = "m/d/yyyy"
Cells(i, y + 3).Value = Cells(i, y + 1).Value + Cells(i, y + 2).Value
Cells(i, y + 4).NumberFormat = "m/d/yyyy"
Cells(i, y + 4).Formula = "=TODAY()"
Cells(i, y + 5).NumberFormat = "0"
Cells(i, y + 6).NumberFormat = "#,##0.00"
Cells(i, y + 7).NumberFormat = "#,##0.00"
Cells(i, y + 8).NumberFormat = "#,##0.00"
Cells(i, y + 9).NumberFormat = "#,##0.00"
Cells(i, y + 10).NumberFormat = "#,##0.00"
Cells(i, y + 11).NumberFormat = "#,##0.00"
Cells(i, y + 12).NumberFormat = "#,##0.00"
Cells(i, y + 13).NumberFormat = "#,##0.00"
Cells(i, y + 14).NumberFormat = "#,##0.00"
Cells(i, y + 5).Value = Cells(i, y + 4).Value - Cells(i, y + 3).Value
Cells(i, y + 2).Value = 30
A = Cells(i, y + 5).Value
If (A <= 0) Then Cells(i, y + 7).Value = Cells(i, y + 6).Value
Else: Cells(i, y + 7).Value = Cells(i, y + 16).Value
If ((A > 0) And (A <= 30)) Then Cells(i, y + 8).Value = Cells(i, y + 6).Value
Else: Cells(i, y + 8).Value = Cells(i, y + 16).Value
If ((A > 30) And (A)) Then Cells(i, y + 9).Value = Cells(i, y + 6).Value
Else: Cells(i, y + 9).Value = Cells(i, y + 16).Value
If ((A > 45) And (A <= 60)) Then Cells(i, y + 10).Value = Cells(i, y + 6).Value
Else: Cells(i, y + 10).Value = Cells(i, y + 16).Value
If ((A > 60) And (A <= 75)) Then Cells(i, y + 11).Value = Cells(i, y + 6).Value
Else: Cells(i, y + 11).Value = Cells(i, y + 16).Value
If ((A > 75) And (A <= 90)) Then Cells(i, y + 12).Value = Cells(i, y + 6).Value
Else: Cells(i, y + 12).Value = Cells(i, y + 16).Value
If (A > 90) Then Cells(i, y + 13).Value = Cells(i, y + 6).Value
Else: Cells(i, y + 13).Value = Cells(i, y + 16).Value
Cells(i, y + 14).Value = Cells(i, y + 8).Value + Cells(i, y + 9).Value + Cells(i, y + 10).Value + Cells(i, y + 11).Value + Cells(i, y + 12).Value + Cells(i, y + 13).Value
Loop
j = y
i = x
Do While ((ColorIndex(Cells(i, y))) <> 21)
For j = y + 1 To 14
Cells(i, j).Interior.ColorIndex = ColorIndex(Cells(i, x))
If Cells(i, j).Interior.ColorIndex = 24 Then Cells(i, j).Value = Cells(x, y + 16).Value
End If
Next j
Loop
For j = 6 To 14
Summa_po_tsvetam (Cells(x, j))
Next j
End Sub
Подскажите, пожалуйста, в чем моя ошибка?
Sub Macros()
Dim i As Integer
Dim j As Integer
Dim x As Integer
Dim y As Integer
Dim A As Double
x = ActiveCell.Row
y = ActiveCell.Column
i = x
Do While ((ColorIndex(Cells(i, y))) <> 21)
Cells(i, y + 6).Value = Cells(i, y + 1).Value
Cells(i, y + 1).Formula = "=MID(RC[-1],SEARCH(""??.??.????"",RC[-1],1),10)"
Cells(i, y + 1).NumberFormat = "m/d/yyyy"
Cells(i, y + 2).NumberFormat = "0"
Cells(i, y + 3).NumberFormat = "m/d/yyyy"
Cells(i, y + 3).Value = Cells(i, y + 1).Value + Cells(i, y + 2).Value
Cells(i, y + 4).NumberFormat = "m/d/yyyy"
Cells(i, y + 4).Formula = "=TODAY()"
Cells(i, y + 5).NumberFormat = "0"
Cells(i, y + 6).NumberFormat = "#,##0.00"
Cells(i, y + 7).NumberFormat = "#,##0.00"
Cells(i, y + 8).NumberFormat = "#,##0.00"
Cells(i, y + 9).NumberFormat = "#,##0.00"
Cells(i, y + 10).NumberFormat = "#,##0.00"
Cells(i, y + 11).NumberFormat = "#,##0.00"
Cells(i, y + 12).NumberFormat = "#,##0.00"
Cells(i, y + 13).NumberFormat = "#,##0.00"
Cells(i, y + 14).NumberFormat = "#,##0.00"
Cells(i, y + 5).Value = Cells(i, y + 4).Value - Cells(i, y + 3).Value
Cells(i, y + 2).Value = 30
A = Cells(i, y + 5).Value
If (A <= 0) Then Cells(i, y + 7).Value = Cells(i, y + 6).Value
Else: Cells(i, y + 7).Value = Cells(i, y + 16).Value
If ((A > 0) And (A <= 30)) Then Cells(i, y + 8).Value = Cells(i, y + 6).Value
Else: Cells(i, y + 8).Value = Cells(i, y + 16).Value
If ((A > 30) And (A)) Then Cells(i, y + 9).Value = Cells(i, y + 6).Value
Else: Cells(i, y + 9).Value = Cells(i, y + 16).Value
If ((A > 45) And (A <= 60)) Then Cells(i, y + 10).Value = Cells(i, y + 6).Value
Else: Cells(i, y + 10).Value = Cells(i, y + 16).Value
If ((A > 60) And (A <= 75)) Then Cells(i, y + 11).Value = Cells(i, y + 6).Value
Else: Cells(i, y + 11).Value = Cells(i, y + 16).Value
If ((A > 75) And (A <= 90)) Then Cells(i, y + 12).Value = Cells(i, y + 6).Value
Else: Cells(i, y + 12).Value = Cells(i, y + 16).Value
If (A > 90) Then Cells(i, y + 13).Value = Cells(i, y + 6).Value
Else: Cells(i, y + 13).Value = Cells(i, y + 16).Value
Cells(i, y + 14).Value = Cells(i, y + 8).Value + Cells(i, y + 9).Value + Cells(i, y + 10).Value + Cells(i, y + 11).Value + Cells(i, y + 12).Value + Cells(i, y + 13).Value
Loop
j = y
i = x
Do While ((ColorIndex(Cells(i, y))) <> 21)
For j = y + 1 To 14
Cells(i, j).Interior.ColorIndex = ColorIndex(Cells(i, x))
If Cells(i, j).Interior.ColorIndex = 24 Then Cells(i, j).Value = Cells(x, y + 16).Value
End If
Next j
Loop
For j = 6 To 14
Summa_po_tsvetam (Cells(x, j))
Next j
End Sub
Подскажите, пожалуйста, в чем моя ошибка?