C
cimbom
Hi all,
The macro below is for a basic calculation as shown:
G H I J
Inventory Orders Safety Production
45 25 10 -10 (H3+I3-G3)
If the Production J3 is negative, change the safety (I3) to a number
so that Production will be 0. In this case, Safety should be 20 in
order for Production to be 0.
The Macro below works perfectly, but it only changes this specific
cells (I3 and J3). I have 300 rows. How can I change this Macro below
so that when I run it, it affects 300 rows instead of just 1?
Thank you
Sub Solve()
'J3=production cell
a = Range("J3").Value
'I3=safety cell
b = Range("I3").Value
If a < 0 Then
Range("I3").Value = b + a * -1
End If
End Sub
The macro below is for a basic calculation as shown:
G H I J
Inventory Orders Safety Production
45 25 10 -10 (H3+I3-G3)
If the Production J3 is negative, change the safety (I3) to a number
so that Production will be 0. In this case, Safety should be 20 in
order for Production to be 0.
The Macro below works perfectly, but it only changes this specific
cells (I3 and J3). I have 300 rows. How can I change this Macro below
so that when I run it, it affects 300 rows instead of just 1?
Thank you
Sub Solve()
'J3=production cell
a = Range("J3").Value
'I3=safety cell
b = Range("I3").Value
If a < 0 Then
Range("I3").Value = b + a * -1
End If
End Sub