View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mike Fogleman[_2_] Mike Fogleman[_2_] is offline
external usenet poster
 
Posts: 206
Default sheets that mirror each other

Yes, that seems to do it:
sheet1 code

Private Sub Worksheet_Change(ByVal Target As Range)
If Application.ActiveSheet.CodeName = "Sheet1" Then
Sheet2.Range(Target.Address).Value = Target.Value
Else
Exit Sub
End If
'MsgBox ("Im in Sheet1")
End Sub

sheet2 code

Private Sub Worksheet_Change(ByVal Target As Range)
If Application.ActiveSheet.CodeName = "Sheet2" Then
Sheet1.Range(Target.Address).Value = Target.Value
Else
Exit Sub
End If
'MsgBox ("Im in Sheet2")
End Sub

Mike F
"Robert Crandal" wrote in message
...
How about the following code in the Worksheet_Change()
for Sheet1:

If Application.ActiveSheet.CodeName = "Sheet1" Then
' copy data to Sheet2
End if

Then, in the code for Worksheet_Change() for Sheet2,
use the following:

If Application.ActiveSheet.CodeName = "Sheet2" Then
' copy data to Sheet1
End if

What do you think about that idea??


"Mike Fogleman" wrote in message
...
Let me study this once more. There must be a way, maybe with an IF
statement.

Mike F
"Robert Crandal" wrote in message
...
Try putting a MsgBox("Im in Sheet1") statement in the
Worksheet_Change() function for sheet1. It will
give you about 45 message boxes/dialog boxes that
say "I'm in Sheet1". It appears that Excel runs out of
stack space at that point.