Adding into a Series of Numbers

999HelpPlease

New Member
Joined
Jul 16, 2014
Messages
35
10 - Example Number

Let's say I have a spreadsheet and I wanted to add cell example "H1" to the entire column of H.

How do I write this in VBA?

The number 10 could change but the 10 would already be added and it could stay that way.

I am confused on how to write this one. Can anyone give me some suggestions?
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
I am sorry, your post is very confusing.
Can you try rephrasing it?
 
Upvote 0
I will try. If you look at the spreadsheet below. What I want to do is take the 10 and add it into every number in that column. So it would add it to all the 3's and they would become 13. Does this help.

10
123
123
123
123
123
123
123
123
123

<colgroup><col width="64" style="width:48pt" span="3"> <tbody>
</tbody>
 
Upvote 0
OK. Where is this number coming from?
Will it be a cell on a sheet, or an input asked for when a macro is run?

Note, that if it is a cell on your sheet, this can be done very easily without any VBA.
Just highlight the number and click Copy
Then, highlight the whole range you want to paste it to
Then right-click and select Paste Special -> Add -> OK
 
Last edited:
Upvote 0
Here is what a VBA solution would look like, adding the value from K1 to all the cells in column H, down to the last one.
Code:
Sub MyCopyMacro()

    Dim lastRow As Long
    
'   Find last row in column H
    lastRow = Cells(Rows.Count, "H").End(xlUp).Row
    
'   Add value from K1 to column H
    Range("K1").Copy
    Range("H1:H" & lastRow).PasteSpecial Paste:=xlPasteAll, Operation:=xlAdd, SkipBlanks:= _
        False, Transpose:=False
    Application.CutCopyMode = False

End Sub
If you are looking for an Input solution, just incorporate the same InputBox methodology we discussed in your other thread.
 
Upvote 0

Forum statistics

Threads
1,214,575
Messages
6,120,334
Members
448,956
Latest member
Adamsxl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top