Excel, multiple cells, one value

时光总嘲笑我的痴心妄想 提交于 2019-12-22 17:18:09

问题


I had no idea where to start in Googling... I have a workbook and 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?


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/4146716/excel-multiple-cells-one-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!