How to Add Values in Multiple Selected Cells in Excel

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.

Add Values in Multiple Selected Cells


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.

add values to cells1

#2 open your excel workbook and then click on “Visual Basic” command under DEVELOPER Tab, or just press “ALT+F11” shortcut.

Get the position of the nth using excel vba1

#3 then the “Visual Basic Editor” window will appear.

#4 click “Insert” ->”Module” to create a new module.

convert column number to letter3

#5 paste the below VBA code into the code window. Then clicking “Save” button.

add values to cells2
  
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.

add values to cells3

#7 Let’s see the last result:

add values to cells4

Video: Add Values in Multiple Selected Cells

 

Comments

So empty here ... leave a comment!

Leave a Reply

Your email address will not be published. Required fields are marked *

Sidebar