Keep relationship between 2 cells that both accept data
Very easy with a little event macro:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A1:A2")) Is Nothing Then
Application.EnableEvents = False
If Intersect(Target, Range("A1")) Is Nothing Then
Range("A1").Value = 2 * Range("A2").Value
Else
Range("A2").Value = 0.5 * Range("A1").Value
End If
Application.EnableEvents = True
End If
End Sub
REMEMBER: This macro goes in the worksheet code area, not a standard module.
--
Gary''s Student - gsnu200738
"Arun" wrote:
I swear I saw someone who posted a trick to accomplish this...
I want the value in cell A1 to always be twice the value in A2, but I want
to be able to enter data into either cell (not a formula).
For example, I type a 2 in cell A1 and A2 returns a 1. I then type 3 into
cell A2 and A1 returns a 6.
Is this possible?
|