ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cell Referencing (https://www.excelbanter.com/excel-programming/344633-cell-referencing.html)

oberon.black[_112_]

Cell Referencing
 

need to create a code that will allow me input information into cell
'a1' of worksheet 1, then that information will show in cell 'a1' of
worksheet 1 and in cell 'b2' of worksheet 3.

then I need to use the same or a similar code in cell 'b2' of worksheet
3 so that it will show any information that I put in it back to cell
'a1' of worksheet 1.

I want to do this so that I can update either worksheet and the
information will be current on both worksheets.

please provide complete code.

At a total loss in need of major help.


--
oberon.black
------------------------------------------------------------------------
oberon.black's Profile: http://www.excelforum.com/member.php...o&userid=26732
View this thread: http://www.excelforum.com/showthread...hreadid=481903


Tom Ogilvy

Cell Referencing
 
in the code module of sheet1

Private Sub Worksheet_Change(ByVal Target As Range)
On Error goto ErrHandler
if Target.Address = "$A$1" then
application.EnableEvents = False
worksheets("sheet3").Range("b2").Value = Target.Value
end if
ErrHandler:
Application.EnableEvents = True
End Sub

In the code module of Worksheet 3 put in code:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error goto ErrHandler
if Target.Address = "$B$2" then
application.EnableEvents = False
worksheets("Sheet1").Range("A1").Value = Target.Value
end if
ErrHandler:
Application.EnableEvents = True
End Sub

--
Regards,
Tom Ogilvy


"oberon.black"
wrote in message
news:oberon.black.1xxhym_1131034225.2117@excelforu m-nospam.com...

need to create a code that will allow me input information into cell
'a1' of worksheet 1, then that information will show in cell 'a1' of
worksheet 1 and in cell 'b2' of worksheet 3.

then I need to use the same or a similar code in cell 'b2' of worksheet
3 so that it will show any information that I put in it back to cell
'a1' of worksheet 1.

I want to do this so that I can update either worksheet and the
information will be current on both worksheets.

please provide complete code.

At a total loss in need of major help.


--
oberon.black
------------------------------------------------------------------------
oberon.black's Profile:

http://www.excelforum.com/member.php...o&userid=26732
View this thread: http://www.excelforum.com/showthread...hreadid=481903




oberon.black[_113_]

Cell Referencing
 

Great!!

code works great but why do I have to hit enter twice in the cell.

I input the information then press enter

then I have to go back up to the cell and press enter again.


Please explain to me how the code works?


--
oberon.black
------------------------------------------------------------------------
oberon.black's Profile: http://www.excelforum.com/member.php...o&userid=26732
View this thread: http://www.excelforum.com/showthread...hreadid=481903


Tom Ogilvy

Cell Referencing
 
Works fine for me. Possibly you have other code running which is causing
this problem.

How does it work. When your write in A1 of Sheet1, it duplicates that value
in B2 of sheet3. When you write in B2 of Sheet3, it duplicates that value
in A1 of sheet1. when it does it, it disables events so you don't get
recursive calls.
--
Regards,
Tom Ogilvy


"oberon.black"
wrote in message
news:oberon.black.1xxymo_1131055813.8577@excelforu m-nospam.com...

Great!!

code works great but why do I have to hit enter twice in the cell.

I input the information then press enter

then I have to go back up to the cell and press enter again.


Please explain to me how the code works?


--
oberon.black
------------------------------------------------------------------------
oberon.black's Profile:

http://www.excelforum.com/member.php...o&userid=26732
View this thread: http://www.excelforum.com/showthread...hreadid=481903





All times are GMT +1. The time now is 07:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com