+ Reply to Thread
Results 1 to 2 of 2

Obtaining a Variable for a loop in the cell above

  1. #1
    Registered User
    Join Date
    06-25-2013
    Location
    West Chester, Pennsylvania
    MS-Off Ver
    Excel 2007
    Posts
    1

    Obtaining a Variable for a loop in the cell above

    Greetings, everyone. First time post! Yippee!

    Enough with pleasantries. I need an answer! I've been writing VBA for about a year now, so I'm beginning to get a little more advanced in my coding, although I've run into a stump. I need to write out a loop that will take the reference cell from the cell above it, add 27 to the reference, and so on. Except that reference will always be different. I've tried this, but all I'm getting is the value:

    Please Login or Register  to view this content.
    Obviously that's only going to give me the fact that the cell above says zero. Is there any way to extract the last four numbers of the formula from the cell above?

    Any help would be greatly appreciated, as this is beginning to test my fortitude.

    EDIT:

    I was able to get the formula I needed from the cell above with this code:

    Please Login or Register  to view this content.
    Now what I need to do is this:

    The cell has a formula that is: "=Monthly!R5378"
    I need to take the 5378 and add 27 to it. How can I change the formula each time I run the macro?
    Last edited by exdaver; 06-25-2013 at 11:05 AM. Reason: fixed the above code. Still wrong though.

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Obtaining a Variable for a loop in the cell above

    One way would be to have a helper cell in the activesheet or in a separate sheet.

    Please Login or Register  to view this content.
    You could put 5378 in Sheets("Counter").Range("A1") Then it will increment by 27 each time you run the macro.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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