+ Reply to Thread
Results 1 to 4 of 4

How to loop through rows with data as new inputs for formula

  1. #1
    Registered User
    Join Date
    03-26-2017
    Location
    Germany
    MS-Off Ver
    2016
    Posts
    2

    How to loop through rows with data as new inputs for formula

    Hi All,

    Apologies if this has been asked/answered before but I'm not so well versed with VBA so wouldn't know where to even begin looking for answers so thought I'd just ask.

    I have a list of football results in columns A:D with the date, home team, away team, home goals, and away goals.

    I would like to build something in VBA that takes the first row, moves it to specific cells to be used as inputs for a formula with the results being copied to a seperate worksheet. I already have a macro created for copying process, but each time I need to manually replace the first row of results with the one below it. This isn't a problem with 20 or so results, but I am looking at a dataset with over 10,000 matches and would like some help. Should I be looking up a certain type of loop function or?

    Again apologies if this is a really common question, just have no idea where to begin

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: How to loop through rows with data as new inputs for formula

    Gutentag.

    You did not provide enough information.

    I assumed that your calculation area was E1 to H1 on Sheet1 and the formula is in I1.


    Please Login or Register  to view this content.
    Last edited by mehmetcik; 03-26-2017 at 07:43 PM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: How to loop through rows with data as new inputs for formula

    Hi felix and welcome to the forum,

    I've seen many of these Home Team and Away Team workbooks. Because a team could be in the home or away column, Excel has a problem dealing with a single team in two different columns. See if the attached makes more sense. I think I duplicated each game so I could have a single TEAM column. I did this problem a while back. I then did a pivot table with the results. I think the question on this problem was to rank each team. See if this format of keeping information isn't better for you.
    Football Scorekeeper2.xlsx
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Registered User
    Join Date
    03-26-2017
    Location
    Germany
    MS-Off Ver
    2016
    Posts
    2

    Re: How to loop through rows with data as new inputs for formula

    Hi Guys,

    Thank you for the help! I have the copy to new sheet working fine. The issue I have is automatically updating values in cells E1:H1 (to keep with Mehmetcik's assumption). So I would like to write some code that takes first row of historic data, paste it in cells E1:H1, and after it copies that data moves to the next row until the end of the data set. I will try both of your suggestions tonight and report back how I get on. Apologies if it was a bit unclear, like I said I'm not so experienced in this area!

    Thanks again!

+ 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] loop through array of text inputs
    By TPDave in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-24-2016, 11:39 AM
  2. [SOLVED] VBA to add data at the end of a dataset (2 manual inputs & 1 formula)
    By The_Snook in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-05-2016, 05:16 PM
  3. Replies: 7
    Last Post: 06-22-2016, 04:31 PM
  4. [SOLVED] Loop through checkbox and inputs data based on which is checked
    By joe8904 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-14-2016, 09:51 AM
  5. Speeding up a loop to repeat calculations for different inputs
    By violeta14 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-23-2015, 06:02 AM
  6. How to make rows do automatic inputs?
    By use11 in forum Excel General
    Replies: 1
    Last Post: 07-29-2011, 06:31 AM
  7. Data table with 2 rows of inputs
    By mljs54 in forum Excel General
    Replies: 1
    Last Post: 03-11-2011, 10:43 PM

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