Good morning everyone , I'm creating a progam that should compare a certain time of 2 columns in 2 different sheets , after comparing the values ​​the progam must follow the instrution. let's get to the problem : My variable B is not increasing the value (skipping to the next line) because she just does it when the value in variable B its bigger than the value of the variable A. I'm unable to compile it in progam . when I run the progam , only the variable returns the value ( because the for).

Sub analisar()
a = 6
B = 7
Menor = 0
Maior = 0
somaA = 6
SomaB = 7
ContA = Sheets("Boletim Produção").Cells(6, 42)
ContB = Sheets("Boletim Parada").Cells(7, 4)

For a = 6 To 5000


If Sheets("Boletim Produção").Cells(a, 24) > Sheets("Boletim Parada").Cells(B, 3) Then

Menor = ContA - 0.0007
Maior = ContA + 0.0007

If Menor < ContB And Maior > ContB Then


ContA = ContA + Sheets("Boletim Produção").Cells(a + 1, 42)
ContB = ContB + Sheets("Boletim Parada").Cells(B + 1, 4)
Sheets("Boletim Produção").Cells(a, 42).Interior.Color = rgbGreen
Sheets("Boletim Parada").Cells(B, 4).Interior.Color = rgbGreen
Sheets("Boletim Produção").Cells(10, 47) = ContA
a = a - 1
B = B + 1

Else
If Sheets("Boletim Parada").Cells(B, 3) > Sheets("Boletim Produção").Cells(a, 24) And Sheets("Boletim Produção").Cells(a, 42) = 0 Then



Sheets("Boletim Produção").Cells(a, 42).Interior.Color = rgbRed
Sheets("Boletim Parada").Cells(B, 4).Interior.Color = rgbRed
a = a - 1
B = B + 1
'ContA = Sheets("Boletim Produção").Cells(a, 42)
'ContB = Sheets("Boletim Parada").Cells(B, 4)

'Else
'If Sheets("Boletim Produção").Cells(a, 42) = 0 Then
'b = b + 1

'ElseIf Sheets("Boletim Parada").Cells(b, 4) < Sheets("Boletim Produção").Cells(a, 24) Then
'b = b + 1
'a = a - 1



'Else
'Sheets("Boletim Produção").Cells(a, 42).Interior.Color = rgbRed
'Sheets("Boletim Parada").Cells(b, 4).Interior.Color = rgbRed
'End If

Else
Sheets("Boletim Produção").Cells(a, 42).Interior.Color = rgbGreen
ContA = ContA + Sheets("Boletim Produção").Cells(a + 1, 42)


End If
End If
End If

Next
End Sub