+ Reply to Thread
Results 1 to 8 of 8

Hardcopy list generated by Excel's Data Table, refresh table and repeat

  1. #1
    Registered User
    Join Date
    03-26-2015
    Location
    Netherlands
    MS-Off Ver
    2013
    Posts
    75

    Hardcopy list generated by Excel's Data Table, refresh table and repeat

    Hi everyone!

    I'm wondering if its do able to write a Macro that hardcopies content from Excel's data table function.

    Situation
    I've created a little simulation tool which has one input cell. There is some randomness involved and every time the result cell's value is slightly different. So I used Excel's data table function to provide me with 300 results in one column. Every time I press F9 the table refreshes with 300 new results. However, the distribution of the 300 results stays roughly the same so I'm happy with the reliability of the results based on one value for the input cell.

    The problem
    I now wish to generate such random lists for a large number of different values for the input cell. Manually this would be quite a lot of work and I suspect I'll have to repeat this little experiment more often in the future. So it would help me a great deal if a Macro could copy the values of the data table (in say column A), hardcopy it in a different column (e.g. B), change the value of the input cell and then make a new hardcopy of the results (e.g. column C) with the new input value. And repeat.

    It would be nice if I could designate the number of hardcopies it should make and the increase in the input cell's value for each ''run''.

    I've been trying to make a macro myself but without succes. It could be due to the fact that Excel needs to be able to refresh the sheet between hardcopies. Anyone willing to give it a shot?

    Thanks in advance!

    Best,
    Ronnet

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Hardcopy list generated by Excel's Data Table, refresh table and repeat

    Hello Ronnet2,

    Can you post your workbook ? It make testing easier and more reliable.

    How To Post Your Workbook
    1. At the bottom right of the Reply window, Click the button Go Advanced
    2. At the top of the Your Message Window, in the first row of icons, Click the Paperclip icon.
    3. Click the Add Files button at the top right in the dialog box. This displays the File Manager dialog.
    4. Click the Select Files button at the bottom middle of the dialog.
    5. In the new window Find the file you want to upload, select it, and Click Open.
    6. You will now be back in the File Manager dialog. Click the bottom Middle button Upload File.
    7. Wait until the file has completely uploaded before you exit the File Manager dialog.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,461

    Re: Hardcopy list generated by Excel's Data Table, refresh table and repeat

    Suggest you upload a sample workbook.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    03-26-2015
    Location
    Netherlands
    MS-Off Ver
    2013
    Posts
    75

    Re: Hardcopy list generated by Excel's Data Table, refresh table and repeat

    I'm not allowed to attach the actual simulation, its sensitive information.

    However, I've attached a demonstration file.

    On the first sheet you see the green cell. This is the input value of the simulation. It generates a random result. I've called this the blackbox since I cant attach the actual simulation. To simulate randomness I've used the rand() function in this demonstration file.

    On the second sheet I have a data table that basically does the simulation 300 times in one column (the yellow cells) for the input value in the green cell.

    Sheet 3 provides an example of what I hope to get from a Macro. Basically hard copies of the yellow cells column with the corresponding green cell on top (for easy reading).

    On sheet 1 I've also added 'number of runs' and 'increase per run' this is to control the size of the macro work. It corresponds with the number of hard copied columns on sheet 3 as well as the increase in input cell value seen in the green cell copies on sheeet 3.

    Hopefully this helps
    Attached Files Attached Files

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Hardcopy list generated by Excel's Data Table, refresh table and repeat

    Hello Ronnet2,

    I have added a button to the "Simulation"worksheet to run the macro below. The attached workbook has the macro added to it.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    03-26-2015
    Location
    Netherlands
    MS-Off Ver
    2013
    Posts
    75

    Re: Hardcopy list generated by Excel's Data Table, refresh table and repeat

    Hello Leith Ross, thank you very much. In the example file it works great and exactly as I wanted it to. So thank you very much. Before Monday I'll try to integrate the macro in the simulation. If so, I'll close the thread. Once again, thank you very much!

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Hardcopy list generated by Excel's Data Table, refresh table and repeat

    Hello Ronnet2,

    You're welcome. I wish you success with the integration.

  8. #8
    Registered User
    Join Date
    03-26-2015
    Location
    Netherlands
    MS-Off Ver
    2013
    Posts
    75

    Re: Hardcopy list generated by Excel's Data Table, refresh table and repeat

    I've been extensively testing the model and I've run into a small issue. The number of the run indicated in the green top row does not match the results in the yellow rows below. This becomes apparant when you remove variability from the results.

    For example: in the output sheet the green input value cell says 304 with a corresponding output value in the yellow cells of 42,74. However, 42,74 should be the output of the input value 303. So essentially the green input alues belong to the yellow outcome values one column to the right. Is it possible to easily fix this?

+ 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: 6
    Last Post: 02-23-2024, 02:11 PM
  2. Select item of a dropdown list (data validation) and refresh one pivot table
    By ATN123 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-17-2014, 07:40 AM
  3. PProtect a sheet containing a pivot table but allow table to refresh data?
    By ThomasCarter in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 01-22-2013, 05:46 AM
  4. import data from access table to excel pivot table - Enable Auto Refresh
    By okl in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 02-01-2010, 09:38 AM
  5. [SOLVED] Can Excel Viewer be used to refresh data in a pivot table?
    By Brian O'Neill in forum Excel General
    Replies: 1
    Last Post: 07-29-2006, 08:40 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