ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   adding ranges (https://www.excelbanter.com/excel-discussion-misc-queries/56492-adding-ranges.html)

[email protected]

adding ranges
 
how do i make a button that adds
two ranges together
i.e
adds a1 to c1, a2 to c2 etc..
and places these values in the "a" column where the previous values were

Gord Dibben

adding ranges
 
Sub Test()
For Each Cell In Selection
Cell.Value = Cell.Value & Cell.Offset(0, 2).Value
'if need a space between use
'Cell.Value = Cell.Value & " " & Cell.Offset(0, 2).Value
Next
End Sub

Assign this macro to a button.

Select data range in column A and click the button.


Gord Dibben Excel MVP

On Mon, 21 Nov 2005 06:07:07 -0800,
wrote:

how do i make a button that adds
two ranges together
i.e
adds a1 to c1, a2 to c2 etc..
and places these values in the "a" column where the previous values were



B. R.Ramachandran

adding ranges
 
Hi,

Even though the following approach doesn't 'create a button' to do what you
want, it nevertheless achieves your objective.

Select and copy Column C -- Select Column A (note that the selections
should be of the same size) -- "Edit" -- "Paste Special" and check "Add"
(under "Operation") -- "OK"

Please note that the original contents of Column A are overwritten by the
new values; so you won't have a record of the old data (of course, you can
get them back by doing the reverse)

Regards,
B. R. Ramachandran

" wrote:

how do i make a button that adds
two ranges together
i.e
adds a1 to c1, a2 to c2 etc..
and places these values in the "a" column where the previous values were



All times are GMT +1. The time now is 02:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com