Thread: Mirror Cells
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Nicolas Cachanosky Nicolas Cachanosky is offline
external usenet poster
 
Posts: 3
Default Mirror Cells

Chip, Jim;

Many thanks to you both!
I've been trying to "break" the loop and give up and decided to "post" the
question when I've foud Chip's note.

Tks a lot!!!!!

Kind Rgds!!!!!

--
Nicolas Cachanosky


"Chip Pearson" wrote:

You definitely want to disable events in the code. Otherwise, you'll loop
until VBA decides to kill the loop.

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ErrH:
Application.EnableEvents = False
Select Case Target.Address
Case "$A$1"
Range("B1").Value = Target.Value
Case "$B$1"
Range("A1").Value = Target.Value
End Select
ErrH:
Application.EnableEvents = True
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email on the web site)



"Jim Thomlinson" wrote in message
...
This is event code so it must go in the sheet that you have the mirrored
cells on (Right click the sheet tab and select view code).

Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Address
Case "$A$1"
Range("B1").Value = Target.Value
Case "$B$1"
Range("A1").Value = Target.Value
End Select
End Sub
--
HTH...

Jim Thomlinson


"Nicolas Cachanosky" wrote:

Hi,

I think this might be quit simple, but I can't resolve it anyway.

I have an excel spreadsheet with two cells, for example cell "Value" and
cell "Value.Mirror".

I need that when a change is done in any of these cells, the other does
it
also.
For exmaple, if I change cell "Value" cell "Value.Mirror" should be equal
to
the new value in cell "Value". Also, the other way around, a change in
"Value.Mirror" should be reflected in cell "Value".

I've tried using VBA, but had no luck.

Any advise will be of great help.

Kind Rgds!!!!

Excel 2003/SP1

pd: Just in case is important, both cells are located in different
Sheets.
--
Nicolas Cachanosky