+ Reply to Thread
Results 1 to 7 of 7

Macros - Generate and Copy&Paste results

  1. #1
    Registered User
    Join Date
    06-03-2013
    Location
    Lisbon
    MS-Off Ver
    Excel 2003
    Posts
    19

    Macros - Generate and Copy&Paste results

    Hello everyone. I'm very new to the forums and I came here in desperation for help with macros. I am doing a Masters in Finance and need to start stepping up my excel knowledge, especially when it comes to macros, since we do a lot of repetitions and simulations.

    I'm doing a Monte Carlo simulation, in which I need a macro to do the following:
    *Generate a random number from a normal distribution in a selected column cells
    *copy the result of the simulation (the final value of the option) and paste (only values) the result onto another sheet.
    And I want to repeat the simulation and keep pasting the results along the results column downwards for 10,000 times.
    Now, here's what I managed to do so far:


    Please Login or Register  to view this content.
    As you can see, it's just a simple recording of the steps; That's my extent of macro knowlage. The "calculate" actuion appeared when I pressed F9 with the cells selected. The cells contain the formula NORMINV(RAND();0;1)
    The cell H1004 is the cell with the final result (price of the option). I'd like to have a string of results along the B collum in "Ito Lemma Simulation Results".

    I simply don't know how to make this loop nor how to keep pasting the results one cell downwards in the column.
    This is for a final Options assignment and the teacher wasn't kind enough to show us how to deal with macros, so I really need to talk to someone who knows what they're doing. Thank you very much for all the help you can provide!
    If more information is needed, please tell me.

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

    Re: Macros - Generate and Copy&Paste results

    Something Like this is what you need.

    Good Luck.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-03-2013
    Location
    Lisbon
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: Macros - Generate and Copy&Paste results

    Thank you so much for your response. Unfortunatly, it still keeps pasting on the same cell, over and over again (cell B3). Here's the updated code I used. For now, I changed the number of simulations to 10 just to see if the macro works properly.

    Please Login or Register  to view this content.
    At least it loops now! That's progress at least.

  4. #4
    Registered User
    Join Date
    06-03-2013
    Location
    Lisbon
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: Macros - Generate and Copy&Paste results

    I'm not sure if I'm allowed to bump posts (I didn't read anything about it in the rules. So here it goes.
    Still need help with this one.

  5. #5
    Registered User
    Join Date
    06-03-2013
    Location
    Lisbon
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: Macros - Generate and Copy&Paste results

    Hello? Please?

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macros - Generate and Copy&Paste results

    Use this code line to copy in to next empty row in column B
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-03-2013
    Location
    Lisbon
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: Macros - Generate and Copy&Paste results

    Yes! Thank you very, veyr much!!! It works now!
    Finally, I can make as many simulations as I want, with no effort. ^.^

+ 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