+ Reply to Thread
Results 1 to 5 of 5

Adding loop to current code?

  1. #1
    Registered User
    Join Date
    11-04-2010
    Location
    Minnesota, USA
    MS-Off Ver
    Excel 2003
    Posts
    5

    Adding loop to current code?

    Hello,

    I am having some difficulty with a macro I am working on. I know a little bit about VBA but not very much, I mainly know how to record macros in Excel but I did take an entry level VBA course in college a while ago...

    Here is what I am trying to accomplish, I want to take two values (from my Results Test worksheet) and input them into a "model" (New Model worksheet) which generates results based on the two inputs. Then take those results and paste them into my Results Test worksheet below the input values I used. I need to do this for numerous columns.

    The code below is for just one simulation, I would like to find a way to make this work for a range of columns. The first inputs are in C2 and C3, the next inputs would be D2 and D3, and so on with the generated results below each column of inputs.

    Hopefully this makes sense, I am stumped and will be digging out my VBA book from college tonight but I am not to optimistic it will help me out here.

    Thanks in advance,
    RJ

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Adding loop to current code?

    Hi

    think I've got the positions right...

    Please Login or Register  to view this content.
    rylo

  3. #3
    Registered User
    Join Date
    11-04-2010
    Location
    Minnesota, USA
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Adding loop to current code?

    Thanks Rylo! It worked perfectly, now I am going to try and apply it to another part of my model. Hopefully I won't mess it up to bad.

    Thanks again!
    RJ

  4. #4
    Registered User
    Join Date
    11-04-2010
    Location
    Minnesota, USA
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Adding loop to current code?

    I am using an older version of Excel and I don't have enough columns. How can I switch the code to be in rows? So the inputs pulled from the Results Test sheet would be in A2:B2 then the next inputs in A3:B3... However they will still be input into the New Model sheet in the same cells C5:C6. Then when pasteing the results they will need to be transposed to be in a row and not a column?

    Thanks again!
    Ryan

  5. #5
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Adding loop to current code?

    Ryan

    here you are.
    Please Login or Register  to view this content.
    rylo

+ 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