Good morning, I'm comparing a String from a cell with a given value but i can't make it work, this is the code
Sub Macroprota()
Dim ctotal As Integer, cposible As Integer, contador As Integer
For contador = 2 To 9551
If Right(Cells(contador, 6).Value, 3) = "c/3" Then
ctotal = Cells(contador, 15).Value * 2
ctotal = ctotal - Cells(contador, 12).Value
cposible = ctotal / 3
cposible = cposible * 3
cposible = ctotal - cposible
If cposible > 2 Then
ctotal = ctotal + cposible
Else
ctotal = ctotal - cposible
End If
End If
Next contador
End Sub
Sub Macroprota()
Dim ctotal As Integer, cposible As Integer, contador As Integer
For contador = 2 To 9551
If Right(Cells(contador, 6).Value, 3) = "c/3" Then
ctotal = Cells(contador, 15).Value * 2
ctotal = ctotal - Cells(contador, 12).Value
cposible = ctotal / 3
cposible = cposible * 3
cposible = ctotal - cposible
If cposible > 2 Then
ctotal = ctotal + cposible
Else
ctotal = ctotal - cposible
End If
End If
Next contador
End Sub