Home » excel » excel assign the value and formatting of a cell

excel assign the value and formatting of a cell

Posted by: admin April 23, 2020 Leave a comment

Questions:

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.

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.

How to&Answers:

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

enter image description here

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.