Is there a way to make it possible to edit one cell, then the value gets mirrored in another cell AND VICE VERSA?

Zedrick13

Board Regular
Joined
Sep 8, 2018
Messages
100
In case possible, how do I make a cell's value reflect in another cell and have the capability to edit the value on either cell? For example, I have cell A1 in Sheet 1 and A2 in Sheet 2. I want it that when I put "Pass" as the value for 'Sheet1'!A1, the same value appears in 'Sheet2'!A2. Conversely, I also want to be able to modify the value of 'Sheet2'!A2 and it would reflect on 'Sheet1'!A1.

Hope this makes sense.

Thanks in advance!
 
Sorry to bother you again. The code that you all shared works perfectly. But, I think I messed it up when I attempted to add to the code to make another cell mirror the value of another. I hope you can look at it and see how I can possibly correct it. Here's the link to the file:

https://drive.google.com/open?id=1Z1T5xBofNAtQvvJwkwUxHeGZESvrA6a5

Additional Notes:
If you look under the 'Results Summary' sheet, you will see the list of cells I want the value to be mirrored to cells in other sheets. They are highlighted in red border.

For items from B4-B152, I want the corresponding cells under Result and Date columns to be mirrored in cells under the other sheets (sheet names are the same as each test case ID)

Example:
For 'P2P.PIV2' sheet, I need cell C12 to have the same value as 'Results Summary'!E4, and C15 to 'Results Summary'!F4.

For items from B153-B343, I only want the value of each corresponding cells under the 'Result' tab to reflect the value of each corresponding cells for the 'Overall Result' found on any of the following sheets:
1. Dev - Workflow Testing
2. PS - Workflow Testing
3. Corp - Workflow Testing

Example:
1. AU PO WF-1A [WF - DEV (Approval)] - 'Results Sumarry'!E153 should be the same as 'Dev - Workflow Testing'!O20
2. AU PO WF-1A [WF - DEV (Reject)] - 'Results Sumarry'!E154 should be the same as 'Dev - Workflow Testing'!W2

Not quite. Here is how I would do it:

For Sheet1 module:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'   To be placed in Sheet1 module


    Dim rng As Range
    Dim cell As Range
    Dim addr As String
    
'   Capture cells updated in our designated range
    Set rng = Intersect(Target, Range("A1:A5"))
    
'   Exit if no cells in range being updated
    If rng Is Nothing Then Exit Sub
    
    Application.EnableEvents = False


'   Loop through cells just updated in our designated range
    For Each cell In rng
'       Capture address and update corresponding cell on sheet 2
        addr = cell.Address
        Sheets("Sheet2").Range(addr) = cell
    Next cell
    
    Application.EnableEvents = True
    
End Sub
For Sheet2 module:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'   To be placed in Sheet2 module


    Dim rng As Range
    Dim cell As Range
    Dim addr As String
    
'   Capture cells updated in our designated range
    Set rng = Intersect(Target, Range("A1:A5"))
    
'   Exit if no cells in range being updated
    If rng Is Nothing Then Exit Sub
    
    Application.EnableEvents = False


'   Loop through cells just updated in our designated range
    For Each cell In rng
'       Capture address and update corresponding cell on sheet 2
        addr = cell.Address
        Sheets("Sheet1").Range(addr) = cell
    Next cell
    
    Application.EnableEvents = True
    
End Sub
 
Last edited:
Upvote 0

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
I am sorry, but I do not have the ability to download files from my current location, so I cannot look at your file today.
But it sounds like you have ramped up the complexity significantly, especially if the cells that correspond between the sheets do not have the same cell address, as mentioned here:
1. AU PO WF-1A [WF - DEV (Approval)] - 'Results Sumarry'!E153 should be the same as 'Dev - Workflow Testing'!O20
You may have to handle those differently in separate blocks beneath the loop. Maybe use a Case statement (see: https://www.techonthenet.com/excel/formulas/case.php).

So here is an example that shows you what that might look like that you should be able to emulate:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'   To be placed in Sheet1 module

    Dim cell As Range
    Dim addr As String
    
    Application.EnableEvents = False

'   Loop through cells just updated
    For Each cell In Target
'       Capture address
        addr = cell.Address(0, 0)
'       See if they have any of the following addresses
        Select Case addr
'           What to do if cell A2 is updated (update cell D10 on Sheet2)
            Case "A2"
                Sheets("Sheet2").Range("D10") = cell
'           What to do if cells B10 is upated (update cell Z1 on Sheet2)
            Case "B10"
                Sheets("Sheet2").Range("Z1") = cell
'           What to do if cells C1 or C2 are updated (update same cell on Sheet2)
            Case "C1", "C2"
                Sheets("Sheet2").Range(addr) = cell
        End Select
    Next cell
    
    Application.EnableEvents = True
    
End Sub
You can keep adding more "Cases" for your other cells (you may have quite a bit).
 
Upvote 0

Forum statistics

Threads
1,221,525
Messages
6,160,329
Members
451,637
Latest member
hvp2262

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top