+ Reply to Thread
Results 1 to 17 of 17

Generate subsheet or workbook based on master

  1. #1
    Registered User
    Join Date
    09-14-2016
    Location
    Aarhus, Denmark
    MS-Off Ver
    2013
    Posts
    18

    Generate subsheet or workbook based on master

    Hi all

    I need a macro that can copy data from a master sheet onto either a subsheet or another workbook. I would very much like the following:

    - be able to set a column range so I can pick out certain columns to be copied, as well as a row range. What would be extremely neat, is if the columns are a part of the macro i.e. fixed, while the row range could appear as an input option when the macro button is clicked.

    - because I need 3-4 specific subsheets or workbooks copying different columns from the mastersheet, and those who are gonna use it are very unskilled in excel, I would like it as a macro button that can be named.

    - it needs to be quite simple, because I'm quite the beginner at this stuff, which also means that a short tutorial would be much appreciated.

    - it also needs to function in both excel 2010 and 2013.


    In advance, thank you so much for your help and sorry for butchering the macro lingo.

    Kind regards Chris
    Last edited by ChrisLN; 09-14-2016 at 08:59 AM.

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Generate subsheet or workbook based on master

    It would be easier to follow and test possible solutions if you could post a sample file with some data to demonstrate what you want to do. Explain in detail, step by step what you would like to see happen referring to specific cells and worksheets.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,865

    Re: Generate subsheet or workbook based on master

    Please Login or Register  to view this content.
    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Registered User
    Join Date
    09-14-2016
    Location
    Aarhus, Denmark
    MS-Off Ver
    2013
    Posts
    18

    Re: Generate subsheet or workbook based on master

    @Mumps: A link to the sheet is posted here below. Basically what I want is to pick certain columns and a range of rows from the sheet named "uddannelser" and then copy it onto a new sheet or workbook - sheet1 is an example of how it should look.

    @alansidman: I followed your instructions, but couldn't get it to work. Got an error at the end of the input options. Could you give me an example, perhaps based on the linked sheet below. I might have entered the columns, rows, and sheet wrong. I tried for columns: A1:A5 | for rows: 35 | for sheet: sheet1 (a sheet that was already created - should it not be?).

    http://www.megafileupload.com/ojM7/Macro-needed.xlsx

    Thanks in advance for all your help!

    Kind regards Chris
    Last edited by ChrisLN; 09-15-2016 at 03:09 AM.

  5. #5
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Generate subsheet or workbook based on master

    Hi Chris. I'm sorry but my antivirus software blocks the site where you have uploaded your file. Please try a free site such as www.box.com. or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here.

  6. #6
    Registered User
    Join Date
    09-14-2016
    Location
    Aarhus, Denmark
    MS-Off Ver
    2013
    Posts
    18

    Re: Generate subsheet or workbook based on master

    Quote Originally Posted by Mumps1 View Post
    Hi Chris. I'm sorry but my antivirus software blocks the site where you have uploaded your file. Please try a free site such as www.box.com. or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here.
    https://1drv.ms/f/s!ApOE5FTZWJ3whJEytqrbMRgC5Pvplg - hopefully this works, its via ondrive.

    Again what I am looking for is a macro where I can:

    - type in the specific columns I want it to copy, but into the macro-code / VBA itself, NOT as a pop-up input option.

    - I would like the row range to pop-up as an input option though.

    - I would like it to output the selected columns to a new workbook, and NOT a sheet.

    - It must be able to both function in Excel 2010 and 2013.

    Basically something like this, but with a row range option:
    Please Login or Register  to view this content.

    In advance, thank you so much for the help!

    Kind Regards Chris
    Last edited by alansidman; 09-16-2016 at 10:06 AM.

  7. #7
    Registered User
    Join Date
    09-14-2016
    Location
    Aarhus, Denmark
    MS-Off Ver
    2013
    Posts
    18

    Re: Generate subsheet or workbook based on master

    Got it to work now, but only for a single column. How do I select multiple columns with the macro?

    Quote Originally Posted by alansidman View Post
    Please Login or Register  to view this content.
    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button

  8. #8
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Generate subsheet or workbook based on master

    Try:
    Please Login or Register  to view this content.
    Last edited by alansidman; 09-16-2016 at 10:08 AM.

  9. #9
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,865

    Re: Generate subsheet or workbook based on master

    @Chris

    Code Tags Added
    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 at http://www.excelforum.com/forum-rule...rum-rules.html



    (Because you are new to the forum, I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)

  10. #10
    Registered User
    Join Date
    09-14-2016
    Location
    Aarhus, Denmark
    MS-Off Ver
    2013
    Posts
    18

    Re: Generate subsheet or workbook based on master

    I will try it tomorrow. However, I need the code to be able to pick a row range; like for instance from row 36-70, or from 2-14. Thanks for all your help though! Soo much appreciated.

    Quote Originally Posted by Mumps1 View Post
    Try:
    Please Login or Register  to view this content.

  11. #11
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Generate subsheet or workbook based on master

    Try:
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    09-14-2016
    Location
    Aarhus, Denmark
    MS-Off Ver
    2013
    Posts
    18

    Re: Generate subsheet or workbook based on master

    I get the run-time error '9' : "subscript out of range", when using your script.

    I have been using the macro below with great success, and I think it is simple enough for others to comprehend as well. However, I still need a "row range" pop-up input option. Is it maybe possible to add that to the macro, without altering to much?

    Please Login or Register  to view this content.
    Again, thank you so much for all your help. Sorry for being a complete rookie at this

    Quote Originally Posted by Mumps1 View Post
    Try:
    Please Login or Register  to view this content.
    Last edited by ChrisLN; 09-19-2016 at 07:56 AM.

  13. #13
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Generate subsheet or workbook based on master

    I entered some dummy data in columns H, K and L in the file you posted and then ran the macro and it worked as you requested. Which line of code was highlighted when you got the error?

  14. #14
    Registered User
    Join Date
    09-14-2016
    Location
    Aarhus, Denmark
    MS-Off Ver
    2013
    Posts
    18

    Re: Generate subsheet or workbook based on master

    Quote Originally Posted by Mumps1 View Post
    I entered some dummy data in columns H, K and L in the file you posted and then ran the macro and it worked as you requested. Which line of code was highlighted when you got the error?
    Hi I got it to work. However, compared to the macro I have been using so far (the one I posted in the previous post), it doesn't copy the exact column width of the primary sheet. Is there a way to alter your code to do that? Thanks in advance.

    Kind regards Chris

  15. #15
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Generate subsheet or workbook based on master

    Try:
    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    09-14-2016
    Location
    Aarhus, Denmark
    MS-Off Ver
    2013
    Posts
    18

    Re: Generate subsheet or workbook based on master

    That worked! Thank you so much for your help. I'm using it to optimize exam planning in an administration at a university.

    Kind regards Chris

    Quote Originally Posted by Mumps1 View Post
    Try:
    Please Login or Register  to view this content.

  17. #17
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Generate subsheet or workbook based on master

    It was my pleasure.

+ 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. How to Automatically generate a predefined template using data in master workbook ?
    By Islam_Ismail in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-17-2015, 09:44 AM
  2. [SOLVED] Update rows from master workbook to all other workbooks based on ID
    By bkrajeshkumar in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-14-2015, 12:47 PM
  3. Data entered to Master auto populate to correct subsheet?
    By abardell in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-18-2013, 09:53 AM
  4. Copy Data from Master Sheet to Subsheet Automatically
    By abardell in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-16-2013, 06:04 AM
  5. Auto-generate new weekly workbook based on a saved template
    By jashby1000 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-01-2011, 07:36 AM
  6. Replies: 5
    Last Post: 01-06-2011, 09:29 AM
  7. Remove matching items from a workbook based on a master list
    By Apel in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-16-2009, 08:20 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