+ Reply to Thread
Results 1 to 7 of 7

Loop to next cell and row and edit formula

  1. #1
    Registered User
    Join Date
    07-02-2018
    Location
    Drunen
    MS-Off Ver
    2013
    Posts
    60

    Loop to next cell and row and edit formula

    Hi all,

    I`m having a hard time with this loop. The formula`s that are in use are a bit more complicated than my example but the workings are quite similar. For some reason i cannot add sample file so i`ll try to be as clear as possible.
    -- A -- B -- C -- D -- E
    1 1
    2 formula 2
    3 formula formula 3
    4 formula formula formula 4
    5 formula formula formula formula 5
    6

    This is what the file looks like. Cell A2 contains the following formula: =A$1+10. Cell A3 also has =A$1+10. Then B3 should get =B$2+10, same for B4. So basically i want to copy the formula down 1 cell and then to the next column, but with the previous rownumber +1. So B4 formula to C4 but instead of =B$2+10 i want C$3+10. I tried using activerow but can`t figure this one out.

    Kind regards,
    Last edited by MrMyagiii; 07-02-2019 at 03:46 AM.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,445

    Re: Loop to next cell and row and edit formula

    You can add a sample file by clicking the " Go advanced" button and then " Manage attachments " ( the paperclip is OOO for the moment )

  3. #3
    Registered User
    Join Date
    07-02-2018
    Location
    Drunen
    MS-Off Ver
    2013
    Posts
    60

    Re: Loop to next cell and row and edit formula

    File added. I want the yellow fields to be filled with a macro that also changes the formula
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hi ! Try this ‼


    As a beginner starter :

    PHP Code: 
    Sub Demo()
        
    Dim C%
        For 
    3 To 5:  Cells(1C).Resize(2).FormulaR1C1 "=R" "C+10":  Next
    End Sub 
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !

  5. #5
    Registered User
    Join Date
    07-02-2018
    Location
    Drunen
    MS-Off Ver
    2013
    Posts
    60

    Re: Hi ! Try this ‼

    Ok so a bit more challenging than i thought. I added a new testfile. Columns H and I are correct. I need macro to fill and adjust the formula for the next columns untill P.
    Attached Files Attached Files

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Loop to next cell and row and edit formula

    Try, (no error handling)
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    07-02-2018
    Location
    Drunen
    MS-Off Ver
    2013
    Posts
    60

    Re: Loop to next cell and row and edit formula

    I think you got the other formula than the one i needed. This is copying the v.lookup where i needed the =(I$3*(0,5^(DATUMVERSCHIL(I$1;$G5;"D")/6,67)))

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] VBA - Loop through workbooks, edit specific sheet and cell - easy
    By Formats74 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-07-2017, 06:49 AM
  2. [SOLVED] Blank cell gives error 13 (Mismatch) in loop - edit code to accommodate for blanks
    By onmyway in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-17-2015, 07:35 AM
  3. Replies: 2
    Last Post: 07-09-2009, 11:36 PM
  4. Edit cell formula using VBA
    By strep21 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-31-2009, 05:38 PM
  5. Edit this macro code to loop and end
    By GarToms in forum Excel General
    Replies: 1
    Last Post: 01-27-2006, 08:55 AM
  6. can't edit a cell with a formula
    By hell no in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-06-2005, 08:20 PM
  7. How can i get an If formula in excel to edit another cell?
    By Jimmy Hoffa in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 10:05 AM

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