Hello! This is an example.
I have this table:
What my code does is Substract check if Requerido1 is less or equal to Validacion. If its less it types the value of Requerido 1 in Conf1, then substracts validacion and adds to total Conf. Then does the same for Conf2 with what is remaining from Validacion:
This is what i want it to do, but I want to apply it to every row in that column, not just row 2.
This is what i want it to do, but i want to apply it to every row in that column, not just row 2.
End Sub
I have this table:
Total Inv | Requerido1 | Conf1 | Requerido2 | Conf2 | Validacion | Total Conf |
600 | 550 | 300 | 600 | 0 | ||
600 | 200 | 250 | 600 | 0 | ||
600 | 150 | 400 | 600 | 0 | ||
600 | 100 | 500 | 600 | 0 | ||
600 | 250 | 150 | 600 | 0 |
What my code does is Substract check if Requerido1 is less or equal to Validacion. If its less it types the value of Requerido 1 in Conf1, then substracts validacion and adds to total Conf. Then does the same for Conf2 with what is remaining from Validacion:
Total Inv | Requerido1 | Conf1 | Requerido2 | Conf2 | Validacion | Total Conf |
600 | 550 | 550 | 300 | 50 | 0 | 600 |
600 | 200 | 250 | 600 | 0 | ||
600 | 150 | 400 | 600 | 0 | ||
600 | 100 | 500 | 600 | 0 | ||
600 | 250 | 150 | 600 | 0 |
This is what i want it to do, but I want to apply it to every row in that column, not just row 2.
VBA Code:
Sub Prueba()
If Range("B2") <= Range("F2") Then
Range("C2").Value = Range("B2")
Else
If Range("B2") > Range("F2") Then
Range("C2").Value = Range("F2")
End If
End If
If Range("D2") <= Range("F2") Then
Range("E2").Value = Range("D2")
Else
If Range("D2") > Range("F2") Then
Range("E2").Value = Range("F2")
End If
End If
This is what i want it to do, but i want to apply it to every row in that column, not just row 2.
End Sub