View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
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