Bernard,
I tried re-copying the code under the original code and changed the "Range"
to apply to other cells in an effort to have the same effect but it didn't
work. What did I do wrong?
--
~~Rob
"Bernard Liengme" wrote:
Here is some VBA code to try. Right click the tab of the worksheet in
question, click View Code and copy the code there.
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Application.EnableEvents = False
Set myRange = Intersect(Range("A1"), Target)
If Not myRange Is Nothing Then
' MsgBox "hello"
Range("A2").Value = Range("A2").Value - Int(Target / 2)
End If
Application.EnableEvents = True
End Sub
best wishes
--
Bernard Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
"Rob" wrote in message
...
Hello,
Here's what I am looking to do:
For every multiple of 2 inserted in cell A1, the number in cell A2 is
subtracted by one (ie, in cell A2 is the number 17. If I then insert the
number 6 in A1, A2 is automatically reduced to 14. If the number 20 is in
A2
and then I insert 2 in A1, A2 is automatically reduced to 19, and so on€¦
My
only concern is what will happen if I insert an odd number in A2, is there
a
ROUNDUP option?).
--
~~Rob