Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Adding two cells together


Hi, I have two columns next to each other, i wish to add cells and their
neighbours together, save it as an integer and paste it in an external
workbook. Obviously i could copy both colums into my destination
workbook and have the calculation in there. I was just wondering if it
was possible to do such a thing in vba? I was thinking something along
the following would work, this just brings up an overflow error which i
have not come across before! Am i along the right tracks

Set rng = osheet.Range("D62")
Do
i = rng.Text + rng.Offset(0, 1).Text
MsgBox i

Set rng = rng.Offset(1, 0)
Loop Until rng.row = sRow


--
cereldine
------------------------------------------------------------------------
cereldine's Profile: http://www.excelforum.com/member.php...o&userid=32069
View this thread: http://www.excelforum.com/showthread...hreadid=552266

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 380
Default Adding two cells together

Set rng = osheet.Range("D62")
For i = rng.row to sRow
tmp = Cells(i,4).Value + Cells(i,5).Value
MsgBox tmp
Next i

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"cereldine" wrote
in message ...

Hi, I have two columns next to each other, i wish to add cells and their
neighbours together, save it as an integer and paste it in an external
workbook. Obviously i could copy both colums into my destination
workbook and have the calculation in there. I was just wondering if it
was possible to do such a thing in vba? I was thinking something along
the following would work, this just brings up an overflow error which i
have not come across before! Am i along the right tracks

Set rng = osheet.Range("D62")
Do
i = rng.Text + rng.Offset(0, 1).Text
MsgBox i

Set rng = rng.Offset(1, 0)
Loop Until rng.row = sRow


--
cereldine
------------------------------------------------------------------------
cereldine's Profile:

http://www.excelforum.com/member.php...o&userid=32069
View this thread: http://www.excelforum.com/showthread...hreadid=552266



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 cells tommy Excel Discussion (Misc queries) 1 October 26th 08 09:22 PM
Need help w/ adding cells and dividing SUM by number of cells lnbegin Excel Worksheet Functions 4 September 26th 07 04:26 PM
ADDING CELLS Scott Excel Discussion (Misc queries) 1 March 15th 07 05:37 PM
Adding Cells Kyle Sweeney Excel Worksheet Functions 4 September 15th 05 10:36 AM
Adding colour to a range of cells based on one of the cells v... McKenna Excel Discussion (Misc queries) 4 March 11th 05 02:25 PM


All times are GMT +1. The time now is 04:31 PM.

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

About Us

"It's about Microsoft Excel"