LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Concatenating Formulas

My code below does exactly what I want for the first iteration, but the
second iteration doesn't yield what I want. Below shows what I would like the
result to be. The loop goes through the base column and adds pairs together.
However, I don't just want to add the pairs of numbers together, I want to
build the forumla up as what I show in the Formula Bar section. I am guessing
this has a lot more code behind it than what I have. I suspect that I have to
check if any or both cells have numbers only first and then create a formula
as I have done below. If there is a number and a formula then I would have to
build a different string, and finally if they are both formula's I would have
to replace the = with a + between the pairs.

Am I over complicating this?
The next question is, how do I pickup the formula, add to it with changes
and plunk it back in VB code.

Thanks

Bob


Base Result Formula Bar
2 9 =2+3+4
3 7 =3+4
4


Dim r As Integer
For r = 4 To 3 Step -1
Range("B" & r - 1).Formula = "=" & Range("A" & r - 1) & "+" & Range("A" & r)
Next r
 
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
concatenating Yosh Excel Discussion (Misc queries) 7 February 7th 07 09:03 PM
Need help concatenating and formulas Arkitek Excel Discussion (Misc queries) 1 December 18th 06 10:12 PM
Concatenating two formulas Mukesh Garg Excel Discussion (Misc queries) 4 October 5th 05 12:27 PM
Concatenating IF(AND formulas wellfm Excel Discussion (Misc queries) 3 October 4th 05 07:50 PM
Concatenating Himu Excel Programming 7 July 23rd 05 08:58 PM


All times are GMT +1. The time now is 08:09 PM.

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"