When we want add a Number (for example 5) to all of excel worksheet cells, you can copy cell containing the value 5, select range of other cells we want (for example a 10x10 Range) and Right click-> Paste special then check add Operation and click OK.
I want to add 5 to all of cells in selected range with Excel Interop dll in C#. How can this be achieved?
To perform a Paste Special -> Add operation is fairly easy. Assuming you already have a
Worksheet
object the following will work:You can find a full explanation of the PasteSpecial method here.