开发者

Excel, multiple cells, one value

开发者 https://www.devze.com 2023-01-24 23:34 出处:网络
I had no idea where to start in Googling... I have a workbook a开发者_运维技巧nd want to have 2 cells on different sheets where if one is updated, so is the other. However I want to be able to change

I had no idea where to start in Googling... I have a workbook a开发者_运维技巧nd want to have 2 cells on different sheets where if one is updated, so is the other. However I want to be able to change either cell and the other to update... Is this possible?


You can add a macro fired by the Worksheet Changed event which monitors for changes in either of those cells and copies the change to the other cell.

MSDN Docs on Event


Open up your VB editor in Excel and use something like the following in each of the sheets that are affected as well as changing the sheet names and range desired.

Private Sub Worksheet_Change(ByVal target As Range)
    If target.Address = "$A$1" Then
        ActiveWorkbook.Worksheets("Sheet2").Range(target.Address).Value = target.Value
    End If
End Sub

As stated in a comment on James' answer, this is not really possible without this minute amount of code unless you are using two additional cells.

0

精彩评论

暂无评论...
验证码 换一张
取 消