Thread: Duplication
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
William Benson William Benson is offline
external usenet poster
 
Posts: 121
Default Duplication

Wondereer is looking for a change in EITHER cell getting reflected in the
other cell. In other words, there can be no dependencies other than what VBA
imposes through code.



Option Explicit

'Be Sure You Have Defined The Range FirstRef and
'SecondRef appropriately

Private Sub Worksheet_Change(ByVal Target As Range)
'Code to make changes in one reference range get
'automatically made in another, bi-directionally

Static IgnoreMyChange As Boolean

If IgnoreMyChange Then
IgnoreMyChange = False
Exit Sub
End If

If Replace$(Target.Address, "$", "") = _
Replace$(Range("firstref").Address, "$", "") Then
'Target was firstref, set secondref
IgnoreMyChange = True
Range("SecondRef").Value = Range("FirstRef").Value
IgnoreMyChange = False
Exit Sub
End If

If Replace$(Target.Address, "$", "") = _
Replace$(Range("SecondRef").Address, "$", "") Then
'Target was firstref, set secondref
IgnoreMyChange = True
Range("FirstRef").Value = Range("Secondref").Value
IgnoreMyChange = False
Exit Sub
End If
End Sub




"Max" wrote in message
...
" Wonderer" wrote
I need to know how to have two cells contain the same information, on the
same sheet, so that when I change on cell, the other will reflect that
change. How do I do that?


If you put in say, F1: =IF(A1="","",A1)
F1 will reflect the input in A1.
If A1 is cleared, F1 will display a blank: ""
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----