Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
thanks for the help
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default adding ranges

Use code like the following:

Dim Rng As Range
For Each Rng In Range("A1:A10")
Rng.Value = Rng.Value + Rng(1, 3).Value
Next Rng

Change the A1:A10 to the appropriate range.

I



" wrote
in message
...
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
thanks for the help



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default adding ranges

Sub AddValues()
Dim cell as Range
if Selection.Columns.count 1 then exit sub
if selection.Column < 1 then exit sub
for each cell in selection
if isnumeric(cell.value) and isnumeric(cell.offset(0,2).Value) then
cell.Value = cell.Value + offset(0,2).Cell.Value
end if
Next
End Sub

select the cells in column A that you want to update and run the macro. You
can also manually select the column of contiguous cells in column C, then do
Edit=Copy, then select the first cell in column A and do Edit=Paste
Special and select Values and Add.

--
Regards,
Tom Ogilvy

" wrote in message
...
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
thanks for the help



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Non-Contiguous Ranges COE Excel Discussion (Misc queries) 11 January 24th 06 11:43 PM
adding ranges [email protected] Excel Discussion (Misc queries) 2 November 21st 05 04:22 PM
adding two ranges Monique Excel Programming 9 July 15th 05 04:25 PM
adding named ranges Mike EHB-Docks New Users to Excel 7 April 8th 05 01:53 PM
Adding ranges Bryan via OfficeKB.com Excel Programming 3 February 25th 05 03:06 AM


All times are GMT +1. The time now is 10:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"