+ Reply to Thread
Results 1 to 3 of 3

Build String and then Insert it as Formula to Cell

  1. #1
    Registered User
    Join Date
    01-12-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, 2003
    Posts
    84

    Build String and then Insert it as Formula to Cell

    I am having a difficult time finding a solution to this simple task. I need to insert a formula in a cell, it's a long formula which simply adds up the values from some other cells. The pattern of the cells to be added is offset by 8 rows each time so I thought why not write a VB to do this.

    The formula will look like this:

    =C7+C15+C23+C31.....+C415

    Here is the code I'm trying to make work

    Please Login or Register  to view this content.
    I got this to work although slightly differently in VB2010 Express to write a text file. The string 'y' gets concantenated each time through the loop to get the next cell added to it, then I want to insert the string that 'y' has become as a formula into cell "C1".
    Last edited by Vladamir; 02-11-2012 at 09:01 AM.
    Wish I didn't know now what I didn't know then.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,431

    Re: Build String and then Insert it as Formula to Cell

    try

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    01-12-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, 2003
    Posts
    84

    Re: Build String and then Insert it as Formula to Cell

    Thanks, I had actually resolved this with these corrections before reading your post. This mornings use of VB 2010 Express with it's slightly different syntax threw me off to the spaces being left and the end of the formula needed termination properly. Your code is a little cleaner, so I will use it instead of mine.

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1