Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Mirror Cells

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Mirror Cells

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Mirror Cells

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



  #4   Report Post  
Posted to microsoft.public.excel.programming
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mirror View Dattatraya Excel Discussion (Misc queries) 2 May 19th 10 07:45 PM
Mirror spreadsheet? Rykar2 Excel Discussion (Misc queries) 4 November 12th 05 03:50 AM
Mirror Image nicol28 Excel Worksheet Functions 0 July 26th 05 01:19 AM
How do you "mirror" cells in two workbooks ocampo_tony Excel Discussion (Misc queries) 2 April 12th 05 08:32 PM
2 mirror files with :1 and :2 - why? DJR Excel Discussion (Misc queries) 3 March 21st 05 06:05 PM


All times are GMT +1. The time now is 05:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"