excel分配单元格的值和格式

时间:2021-12-07 20:22:53

I want to assign the cell F2 to have the same value as the cell A2 and also the same formatting so that when I update A2, then F2 gets updated as well.

我想指定单元格F2具有与单元格A2相同的值以及相同的格式,这样当我更新A2时,F2也会更新。

Backstory: I have a whole bunch of Pivot Tables and I want to add them to Pivot charts but apparently pivot charts don't include grand totals so you gotta create new tables identical to pivot tables and then create a new chart which can include the tables with grant totals. My pivot tables have cell number formatting and other formatting that I was hoping there would be an efficient way to preserve.

背景故事:我有一大堆数据透视表,我想将它们添加到数据透视表,但显然数据透视图不包括总计,所以你必须创建与数据透视表相同的新表,然后创建一个新表,其中可以包括表与赠款总额。我的数据透视表具有单元格编号格式和其他格式,我希望有一种有效的保存方式。

1 个解决方案

#1


3  

For fixed format: Enter in F2 the formula =A2. Then copy A2, and in F2 Paste special -> Formats. This should work .

对于固定格式:在F2中输入公式= A2。然后复制A2,并在F2 Paste special - > Formats中。这应该工作。

excel分配单元格的值和格式

For varying format: There is no event for a change in format. To copy the format from A2 to F2 each time the format of A2 changes, a workaround is given To track style changes in Excel 2007/2010 using VBA. You would use this to detect changes, and if needed, copy and paste format via VBA.

对于不同的格式:格式没有变化的事件。要在每次更改A2格式时将格式从A2复制到F2,将给出一种解决方法:使用VBA跟踪Excel 2007/2010中的样式更改。您可以使用它来检测更改,如果需要,可以通过VBA复制和粘贴格式。

#1


3  

For fixed format: Enter in F2 the formula =A2. Then copy A2, and in F2 Paste special -> Formats. This should work .

对于固定格式:在F2中输入公式= A2。然后复制A2,并在F2 Paste special - > Formats中。这应该工作。

excel分配单元格的值和格式

For varying format: There is no event for a change in format. To copy the format from A2 to F2 each time the format of A2 changes, a workaround is given To track style changes in Excel 2007/2010 using VBA. You would use this to detect changes, and if needed, copy and paste format via VBA.

对于不同的格式:格式没有变化的事件。要在每次更改A2格式时将格式从A2复制到F2,将给出一种解决方法:使用VBA跟踪Excel 2007/2010中的样式更改。您可以使用它来检测更改,如果需要,可以通过VBA复制和粘贴格式。