+ Reply to Thread
Results 1 to 17 of 17

Writing table entries underneath each other

  1. #1
    Registered User
    Join Date
    11-08-2012
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    56

    Writing table entries underneath each other

    Hi guys

    I am working on a project involving multiple tables in one sheet. I then want to place the entries of each table underneath each other in another sheet.

    The tables has the same column number, but they vary in row number.

    Furthermore, some of the tables has to be placed underneath eachother several times, triggered by small subtables, that also vary in length (often their are only one)

    Does any of you have en idea of how this may be done? Maybe just parts of it.

    Best regards
    Danny

  2. #2
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Writing table entries underneath each other

    Post a sample workbook with any sensitive information removed?

  3. #3
    Registered User
    Join Date
    11-08-2012
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: Writing table entries underneath each other

    I have tried making a sample workbook that contains the essence of what I want to do.

    Thanks in advance

    /Danny
    Attached Files Attached Files

  4. #4
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Writing table entries underneath each other

    Quote Originally Posted by dannyjoer View Post
    Furthermore, some of the tables has to be placed underneath eachother several times, triggered by small subtables, that also vary in length (often their are only one)
    Please elaborate more on this, i don't really understand "triggered by small subtables". Do you mean if the sub table contains 3 entries, that table right next to it must be "placed underneath" 3 times?

  5. #5
    Registered User
    Join Date
    11-08-2012
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: Writing table entries underneath each other

    Yes, that was precisely what i meant. The number of the times the individiual tables has to be copied underneath eachother,
    depends on how many items are in the sub tables.

  6. #6
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Writing table entries underneath each other

    Ok, got that. So now, question is, how consistent are the tables layout? will it always be in the same format as in the sample workbook?

  7. #7
    Registered User
    Join Date
    11-08-2012
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: Writing table entries underneath each other

    No, the individual tables, aswell as the sub-tables will vary in length, so I am thinking some kind of loop has to employed?

  8. #8
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Writing table entries underneath each other

    having varying length (rows) is fine, but are the columns where the subtables and tables to be copied stand always the same? if yes, then it would be much easier. if no, will the text "Subtable" always be there?

  9. #9
    Registered User
    Join Date
    11-08-2012
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: Writing table entries underneath each other

    The tables all have the same number of columns, including the one where they are supposed to end. I am glad that will make it easier. And thanks for taking the time to help..

  10. #10
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Writing table entries underneath each other

    What I was asking is not the number of columns. What I meant was the layout/positions of the tables. Like in the sample workbook, it starts with a blank column, then the subtable, then another blank column, and then the table to be copied, etc. Does it always appear like this?

  11. #11
    Registered User
    Join Date
    11-08-2012
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: Writing table entries underneath each other

    Oh, sorry. Yes. The position of the tables are fixed (or at least they can be).

  12. #12
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Writing table entries underneath each other

    Try this sample workbook, enable macros, and click the button in Sheet2. If it works as intended, you can move the button's code to a module somewhere (e.g. your PERSONAL workbook).
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    11-08-2012
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: Writing table entries underneath each other

    That is just perfect. Exactly what I was hoping for. Thx a lot.
    A little sub-question, is it possible to have a copy of the entry from the sub-table standing next to all lines from the corresponding table? Please see the enclosed SampleWorkbook
    Attached Files Attached Files

  14. #14
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Writing table entries underneath each other

    Try this. I inserted a "Subtable" column name next to "Plate" as part of the code to run, if you don't need it, you can either delete the text after it's run each time, or let me know and i will need to modify the code again.
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    11-08-2012
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: Writing table entries underneath each other

    Thanks very much for your help. It is solid code. There is one thing though; if the "tables only contain one row of entries, the code copies "Sub-table" to all entries in first column in the master sheet? And i've tried copying the code to another workbook, but couldn't get it to work. Shouldn't I just make a new button and assign that the name from the code (or change it). Sorry for my ignorance..

  16. #16
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Writing table entries underneath each other

    Sorry forgot to test whether it works when there's only 1 row of data. This one should work properly now.

    If you're going to copy the code to a module (in order to assign macro), you need to remove the word "Private" in the first line, and maybe change the name to something that makes more sense, e.g.:
    Please Login or Register  to view this content.
    There are 2 kinds of button you can create in Excel, Forms and ActiveX. The one used in this sample workbook is an ActiveX button, with its code in a Worksheet. If you want the one that allows you to assign macro, use the Forms Control button.
    Attached Files Attached Files

  17. #17
    Registered User
    Join Date
    11-08-2012
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: Writing table entries underneath each other

    Thx for your help.. It works very good..

+ 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. HELP! making a table show up by choice. Writing VBA
    By PrecisionEngine in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-20-2012, 02:37 PM
  2. Extracting data from a table based on a common entries with another table
    By shannoncox in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-31-2012, 04:45 PM
  3. PIvot Table: Help writing a calculated field
    By shannonvhm in forum Excel General
    Replies: 0
    Last Post: 10-22-2009, 11:38 AM
  4. Copy & Paste a row underneath the last one in the table
    By BouncingHippo in forum Excel Programming / VBA / Macros
    Replies: 27
    Last Post: 01-28-2008, 08:30 PM
  5. retain table formatting when writing excel table to a txt file
    By deanop in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-03-2005, 01:05 AM

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