+ Reply to Thread
Results 1 to 3 of 3

Trouble with Formula (in loop)

  1. #1
    Registered User
    Join Date
    10-23-2006
    Posts
    79

    Trouble with Formula (in loop)

    Hi

    I am attempting to use a formula within a loop and I am not sure how to write it...or reference it...

    I have... Cells(i, h).FormulaR1C1 = "=SUM(RC[-(AddCols(g))]:RC[-1])"

    (BTW: g = 0 to 41 and Dim AddCols(41) As Integer - maybe this is incorrect????) It appears to not like the (AddCols(g)) but maybe it does not like the cells part...?

    I am trying to sum up various columns dependant on the variable 'AddCols'.

    Can anyone help..?

    dugong
    Last edited by dugong; 03-11-2008 at 05:18 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    can you post the full code, how are your variables declared?
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    10-23-2006
    Posts
    79
    Thanks RoyUK - I think I have just worked it out!!!

    And, embarrassingly, it was a really simple thing - I had my line with Cells(i, h) but it should have been Cells(h, i)...!!!!!!

    Sometimes the most simple of things causes the most problems...*sigh*

    Thanks for looking anyway... sorry to have troubled you..

    dugong

+ 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