+ Reply to Thread
Results 1 to 5 of 5

Question qbout some very basic commands to help run simulation

  1. #1
    Registered User
    Join Date
    02-20-2016
    Location
    Hong Kong, Hong Kong
    MS-Off Ver
    2016
    Posts
    10

    Question qbout some very basic commands to help run simulation

    Hi there - sorry I am a total beginner and have tried to work this out by Googling, but my VBA code doesn't work!

    I have written an excel spreadsheet to count the number of landings on each square on a monopoly board. Runs successfully for a single iteration and I want to run it say 10000 times, each time refreshing the spreadsheet, and reading and adding the values in for each of the 40 cells containing my results. Finally, I want to write the result in the results section of my spreadsheet. I will start by just trying this for a single cell and then I can add the other 39 cells later.


    What I have so far is this [and my square bracketed comments are just my comments not the code]:

    Please Login or Register  to view this content.


    I know this is very basic stuff, but I am a beginner so would really appreciate some help. Thanks in advance.
    Last edited by slobdiddy; 08-30-2016 at 11:15 AM.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,601

    Re: Question qbout some very basic commands to help run simulation

    Your post does not comply with Rule 3 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 here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

  3. #3
    Registered User
    Join Date
    02-20-2016
    Location
    Hong Kong, Hong Kong
    MS-Off Ver
    2016
    Posts
    10

    Re: Question qbout some very basic commands to help run simulation

    Hi again. Have amended my request as suggested to put code in box. Any help please?

    Many thanks, slobdiddy

  4. #4
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,343

    Re: Question qbout some very basic commands to help run simulation

    Wouldn't you want to tackle the whole problem in one go?

    I'm not sure if i have what you want correct but this basically plays a game of monopoly with 10,000 dice rolls and tells you how many times it landed on each cell in A1 to A40

    Please Login or Register  to view this content.
    edit :
    OK I get its not what you want (not clear what you need - maybe basic help with how the cells(1,1) and range("A1") work?).. but just for fun
    done with an array that is populated once an then returns the values from the array (so that they add up to 10,000 unlike if you ran the iterations sperately).

    Format Monopoly(the_tile_number)

    Please Login or Register  to view this content.
    Last edited by scottiex; 09-04-2016 at 06:56 PM.

  5. #5
    Registered User
    Join Date
    02-20-2016
    Location
    Hong Kong, Hong Kong
    MS-Off Ver
    2016
    Posts
    10

    Re: Question qbout some very basic commands to help run simulation

    Hi there. I have built up quite a complex underlying excel spreadsheet to run a single simulation as part of a school IB project.

    All I need to know how to do is

    - loop 10000 times
    - refresh the spreadsheet each time so that it returns new results
    - read the value in a cell and add it to a total
    - after the loop has finished put the final result Ina spreadsheet

    If someone can help me with the code for a single cell I can work out the rest.

    I did my best using Google but can't get this to run. I think what I am trying to do is so very basic if in just a single value.

    Would really appreciate the help.

    Many thanks

+ 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. Replies: 0
    Last Post: 05-27-2015, 11:32 AM
  2. @RISK-question: RiskTriang(), do new simulation if X < 1,2%
    By Jooakim in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-17-2014, 04:31 PM
  3. Dice 'Simulation game' Question
    By Sabrina19 in forum Excel General
    Replies: 1
    Last Post: 12-14-2010, 07:35 PM
  4. Basic IF loop & commands for an entire column?
    By lieb39 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-30-2010, 05:57 PM
  5. Loss of basic commands in Excel!
    By Sunrunner in forum Excel General
    Replies: 3
    Last Post: 11-27-2006, 07:28 AM
  6. Excel 2003 disliking an old sheet's basic commands
    By F*SH in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-27-2006, 04:29 AM
  7. Visual Basic commands for email
    By David Overington in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-08-2005, 11:06 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