+ Reply to Thread
Results 1 to 20 of 20

Macro to continue looping of formula.

  1. #1
    Forum Contributor
    Join Date
    05-27-2020
    Location
    Bradford
    MS-Off Ver
    office 2016
    Posts
    202

    Macro to continue looping of formula.

    Please can anybody help me, its driving me bonkers!!!

    I would like this standard of code to loop across columns 52 times. As you can see the column range changes.

    Please Login or Register  to view this content.
    Last edited by alansidman; 05-27-2020 at 06:04 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,855

    Re: Macro to continue looping of formula.

    Code Tags Added
    Your post does not comply with Rule 2 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    05-27-2020
    Location
    Bradford
    MS-Off Ver
    office 2016
    Posts
    202

    Re: Macro to continue looping of formula.

    Alan, Sorry I am new to this and still learning. If I put code in I will highlight all and use the # in future I am still learning about VBA very slowly. This forum is great.

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,159

    Re: Macro to continue looping of formula.

    Please Login or Register  to view this content.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  5. #5
    Forum Contributor
    Join Date
    05-27-2020
    Location
    Bradford
    MS-Off Ver
    office 2016
    Posts
    202

    Re: Macro to continue looping of formula.

    Hello Sintek Thank you very much for the quick response. This macro has worked fine. I am just wondering if there is any way that my formula = OFFSET('% SPLIT'!$I30,COLUMNS(C33:$D33)-1,0), could change to -2, - 3 and so when for every time it performed the macro and then it would pick up my data. Cell C33 contained this as a formula and for every week I am trying to use this macro to achieve the results. Any suggestions. I really appreciate the help.

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,159

    Re: Macro to continue looping of formula.

    Not sure what you mean...Perhaps it's time for a sample file...See top yellow banner

  7. #7
    Forum Contributor
    Join Date
    05-27-2020
    Location
    Bradford
    MS-Off Ver
    office 2016
    Posts
    202

    Re: Macro to continue looping of formula.

    Hello I have now attached the spreadsheet. I am trying to use the offset formula =OFFSET('% SPLIT'!$I3,COLUMNS($D6:D6)-1,0) and would like the -1 to change to -2, -3 for each week using a macro.

    I am trying to put the totals from the split spreadsheet into each day for column I and then total each week, but want it to be able to read this for 52 weeks.
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    05-27-2020
    Location
    Bradford
    MS-Off Ver
    office 2016
    Posts
    202

    Re: Macro to continue looping of formula.

    So in the summary I am trying to put all the planned volume totals from the %Split overview and total each week. I planned to use the Macro to fill in each week the data. I thought if I used the offset formula to obtain this which is located in summary cell33, then it would read that and it would work. Maybe the formula is incorrect.

  9. #9
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,159

    Re: Macro to continue looping of formula.

    SPLIT'!$I3,COLUMNS($D6:D6)-1,0) and would like the -1 to change to -2, -3
    This will do exactly what you want...2nd requirement...
    Please Login or Register  to view this content.
    However, as your upload has no expected result I can only guess what you are actually wanting to achieve...

    In order to ensure accuracy, please upload a sample file with an expected result...This way, no time gets wasted on unnecessary coding...
    Last edited by sintek; 05-27-2020 at 09:18 AM.

  10. #10
    Forum Contributor
    Join Date
    05-27-2020
    Location
    Bradford
    MS-Off Ver
    office 2016
    Posts
    202

    Thumbs up Re: Macro to continue looping of formula.

    Hello Sorry for the late response I finish work at 2pm.

    As I am new to this. I have now attached an excel sheet again with some data, how I would like it to format. I am referring to the Summary sheet, which I want to pick the data up for column I in %Split.

    I have the formula in C33 which is =OFFSET('% SPLIT'!$I3,COLUMNS(C33:$D33)-1,0) on the summary sheet. When it is copied into planned volume cell D6 it shows as = OFFSET('% SPLIT'!$I3,COLUMNS(D6:$D6)-1,0). When I copy it to E6 it shows as = OFFSET('% SPLIT'!$I3,COLUMNS($D6:E6)-1,0). When I copy it to F6 it shows = OFFSET('% SPLIT'!$I3,COLUMNS($D6:F6)-1,0).

    Week 2 for Sunday in cell L6 it shows as = OFFSET('% SPLIT'!$I3,COLUMNS($D6:L6)- 2,0) and so on.

    I think it is the way it copies to start as you can see its different in C33 =OFFSET('% SPLIT'!$I3,COLUMNS(C33:$D33)-1,0) and then when it transfers it in D6 shows it as = OFFSET('% SPLIT'!$I3,COLUMNS($D6:D6)-1,0), however this is how I want the pattern to be.

    I basically want the first cell to be D6 with = OFFSET('% SPLIT'!$I3,COLUMNS(D6:$D6)-1,0), E6 to be = OFFSET('% SPLIT'!$I3,COLUMNS($D6:E6)-1,0), F6 to be = OFFSET('% SPLIT'!$I3,COLUMNS($D6:F6)-1,0).

    Week 2 in L6 to be = OFFSET('% SPLIT'!$I3,COLUMNS($D6:L6)- 2,0) and so on.

    I hope this makes sense

    P.S your coding is great I think it is just I am probably not explaining myself correctly. I have put the formula into the cell so you can see the data and how I want it to be )
    Attached Files Attached Files

  11. #11
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,159

    Re: Macro to continue looping of formula.

    I basically want the first cell to be D6 with = OFFSET('% SPLIT'!$I3,COLUMNS(D6:$D6)-1,0), E6 to be = OFFSET('% SPLIT'!$I3,COLUMNS($D6:E6)-1,0), F6 to be = OFFSET('% SPLIT'!$I3,COLUMNS($D6:F6)-1,0).

    Week 2 in L6 to be = OFFSET('% SPLIT'!$I3,COLUMNS($D6:L6)- 2,0) and so on.


    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    05-27-2020
    Location
    Bradford
    MS-Off Ver
    office 2016
    Posts
    202

    Re: Macro to continue looping of formula.

    Absolutely brilliant!!!! I am sorry if I have wasted your time but I can use some of the other code above in other parts.

    Id love to be able to write this code in matter of minutes. you are a star thank you ever so much. I really appreciate your help. Thank you.

  13. #13
    Forum Contributor
    Join Date
    05-27-2020
    Location
    Bradford
    MS-Off Ver
    office 2016
    Posts
    202

    Re: Macro to continue looping of formula.

    Just a question if I wanted the same effects but for actual volume which is located in H on %split. How would the code change, using the same formula at effects?

  14. #14
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,159

    Re: Macro to continue looping of formula.

    Change red snippet 9 to 8
    Please Login or Register  to view this content.

  15. #15
    Forum Contributor
    Join Date
    05-27-2020
    Location
    Bradford
    MS-Off Ver
    office 2016
    Posts
    202

    Re: Macro to continue looping of formula.

    Great thank you I will look at this code later and try and understand it. I will now mark this as complete as you have been more than enough help today. Not sure how to mark as solved yet though. 2nd day and all that.
    Again thank you. I will never be as good as you at coding. If I have any more problems I will be sure to look out for you on here.

  16. #16
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,159

    Re: Macro to continue looping of formula.

    Pleasure...Just like you, I too started from knowing nothing...This forum and Google are great tutors...
    Thanks for rep +

  17. #17
    Forum Contributor
    Join Date
    05-27-2020
    Location
    Bradford
    MS-Off Ver
    office 2016
    Posts
    202

    Re: Macro to continue looping of formula.

    Sorry I have just seen this. Yep have to start some where. I do no know anything about coding or vba really. It just makes my work easier.

    Sorry to ask this, if I wanted to use this below and when I ran the macro and it copied into all the cells, how would I keep the same cell formatting ie the colour in the background.

    Please Login or Register  to view this content.

  18. #18
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,159

    Re: Macro to continue looping of formula.

    try...
    Please Login or Register  to view this content.

  19. #19
    Forum Contributor
    Join Date
    05-27-2020
    Location
    Bradford
    MS-Off Ver
    office 2016
    Posts
    202

    Re: Macro to continue looping of formula.

    Hello Sintek Thank you very much I tried a few things but kept getting an error. Thats worked perfect like normal. I am picking up it up slowly. I am just trying to understand the code first. While you are reading the forum what exactly does FormulaR1C1 = "=SUM(RC[-7]:RC[-1])" mean exactly. What is RC referring to? I know its the sum of the totals but I just wanted to understand what RC in the formula actually means.

  20. #20
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,159

+ 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. Any suggestions for MACRO to continue the Concatenate formula until the last row?
    By kshaver in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-02-2016, 05:48 PM
  2. Pausing a macro for the user to add new info, then continue macro.
    By zookeepertx in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 12-25-2014, 01:38 PM
  3. Pause Macro, move to another cell, continue macro execution
    By slotcardan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-04-2014, 08:23 PM
  4. Trying to continue macro when value is #N/A
    By larstk in forum Excel Programming / VBA / Macros
    Replies: 33
    Last Post: 01-06-2013, 08:28 PM
  5. Replies: 2
    Last Post: 02-24-2011, 05:17 PM
  6. Pause macro, select file, continue macro
    By DamienC in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-18-2008, 07:18 AM
  7. VB Formula error in macro, How to Continue?
    By Mikeco in forum Excel General
    Replies: 7
    Last Post: 04-30-2008, 07:29 PM

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