This post will guide you how to add a specific value in a range of cells in Excel. How do add a number for all values in multiple cells with VBA Macro in Excel.
Assuming that you have a list of data in range B1:B4 that contain numbers, and you want to add number 100 to all cells in Range B1:B4 at once. How to achieve it. You can try to write a new VBA Macro to achieve the result of adding one number to multiple cells in Excel. Just do the following steps:
#1 select cells that you want to add a number, such as: 100.
#2 open your excel workbook and then click on “Visual Basic” command under DEVELOPER Tab, or just press “ALT+F11” shortcut.
#3 then the “Visual Basic Editor” window will appear.
#4 click “Insert” ->”Module” to create a new module.
#5 paste the below VBA code into the code window. Then clicking “Save” button.
Sub AddValueToCells() For Each Mycell In Selection Mycell.Activate ActiveCell.FormulaR1C1 = "= " & ActiveCell.Formula & "+100" Next Mycell End Sub
#6 back to the current worksheet, then run the above excel macro. Click Run button.
#7 Let’s see the last result: