+ Reply to Thread
Results 1 to 25 of 25

Macro to Auto Add Sheet Name to Summary Page In Workbook

  1. #1
    Registered User
    Join Date
    03-27-2014
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    14

    Unhappy Macro to Auto Add Sheet Name to Summary Page In Workbook

    Hi Everyone!

    I am new here and I have a very basic understanding of macro's so I need lots of help! Thanks in advance

    I would like to have a macro created that every time I add a sheet name that contains "Stock_", that sheet name is automatically added to my summary page. Right now, every time I add a sheet with stock details, i have to go to the summary page and manually type in the sheet name so the formulas in the summary page can pick up the relevant information.

    I have added a screenshot to show what my summary page looks like:
    summary page macro help.jpg

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Macro to Auto Add Sheet Name to Summary Page In Workbook

    Try adding this to the workbook module.
    Please Login or Register  to view this content.
    The merged cells make me nervous.
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Registered User
    Join Date
    03-27-2014
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Macro to Auto Add Sheet Name to Summary Page In Workbook

    Thanks so much for the quick reply. So i inserted the code into the module component but nothing happened. Then I tried it again and tried to run it to no avail. I am a beginner at using vba, so i may be missing something. Assistance pls

  4. #4
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Macro to Auto Add Sheet Name to Summary Page In Workbook

    Is it in the module called ThisWorkbook?

    If it is in the correct module it will run automatically when you add a new sheet.

  5. #5
    Registered User
    Join Date
    03-27-2014
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Macro to Auto Add Sheet Name to Summary Page In Workbook

    Ok, so I put the module in this workbook and when I add a new sheet the message box pops up asking for the sheet name. Once I add it though like Stock_ (stocksymbol), I get a debug message. I have attached a screen shot of it. I also re did the summary page to take away the merged cells because you said it made you nervous . Hopefully this will help. I have also attached a screen shot of it. Thanks!Revision to summary page .jpgVBA Error Message.jpg

  6. #6
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Macro to Auto Add Sheet Name to Summary Page In Workbook

    What is the name of the summary sheet?

  7. #7
    Registered User
    Join Date
    03-27-2014
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Macro to Auto Add Sheet Name to Summary Page In Workbook

    The name of the first page is Profit Distribution Summary

  8. #8
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Macro to Auto Add Sheet Name to Summary Page In Workbook

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    03-27-2014
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Macro to Auto Add Sheet Name to Summary Page In Workbook

    Ok, so I put in the new code and I no longer get an error message, but nothing populates on the summary page when I add the new sheet.... Thanks so much for all of you help

  10. #10
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Macro to Auto Add Sheet Name to Summary Page In Workbook

    Does the name of the sheet you're adding start with Stock_ ?

  11. #11
    Registered User
    Join Date
    03-27-2014
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Macro to Auto Add Sheet Name to Summary Page In Workbook

    Yup, I have a template that I created and that's what I enter and I name the sheet Stock_(Stock Symbol)

  12. #12
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Macro to Auto Add Sheet Name to Summary Page In Workbook

    Could you attach your workbook?

  13. #13
    Registered User
    Join Date
    03-27-2014
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Macro to Auto Add Sheet Name to Summary Page In Workbook

    So I attached a sample. Just so you know that the Stock_(stock symbol) is the template I created and anywhere there is something highlighted in green, a value has to be entered. Your awesome. Thanks!!!
    Attached Files Attached Files

  14. #14
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Macro to Auto Add Sheet Name to Summary Page In Workbook

    Try this: Solus Edit.xlsm

  15. #15
    Registered User
    Join Date
    03-27-2014
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Macro to Auto Add Sheet Name to Summary Page In Workbook

    Hi! I enabled the macros and tried inserting a new sheet with Stock_(stock symbol) and it still didn't feed to the summary page...

  16. #16
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Macro to Auto Add Sheet Name to Summary Page In Workbook

    Please Login or Register  to view this content.
    sorry forgot a sheet reference.

  17. #17
    Registered User
    Join Date
    03-27-2014
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Macro to Auto Add Sheet Name to Summary Page In Workbook

    Your quick! Thanks I just stepped away from the computer, as soon as I get back in I am goinh to try it. So excited

  18. #18
    Registered User
    Join Date
    03-27-2014
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Macro to Auto Add Sheet Name to Summary Page In Workbook

    Hey! So the names show up in the summary page, but the names start showing up in column Q5 instead of E5, do you think its because I have "stock name" in the columns??? I attached a screenshotStarts in Column Q.jpg

  19. #19
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Macro to Auto Add Sheet Name to Summary Page In Workbook

    Yes. It adds Stock * to the last empty column. If it placed it at the first column it would continue to erase the Stocks already placed there.

  20. #20
    Registered User
    Join Date
    03-27-2014
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Macro to Auto Add Sheet Name to Summary Page In Workbook

    I need the sheet names to populate from E5 to Q5 so the formulas can pick up the right numbers. So I removed the text and formatting entered in those cells so that it can start pooulating from E5, but even with an empty cell, now when I add a sheet with stock_ nothing shows up in the summary page again... HELP

  21. #21
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Macro to Auto Add Sheet Name to Summary Page In Workbook

    Attach latest version with code in place please.

  22. #22
    Registered User
    Join Date
    03-27-2014
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Macro to Auto Add Sheet Name to Summary Page In Workbook

    Would it be better to have like a blank sheet in the workbook that has a formula/macro or something that automatically lists all of the worksheets with the name Stock_ and I just have the summary page pick up information from that list. Almost like a table of contents for the sheets that contain the stock information...

  23. #23
    Registered User
    Join Date
    03-27-2014
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Macro to Auto Add Sheet Name to Summary Page In Workbook

    Here you go. Thanks
    Attached Files Attached Files

  24. #24
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Macro to Auto Add Sheet Name to Summary Page In Workbook

    Your suggestion in post #22 would probably be more consistent.

  25. #25
    Registered User
    Join Date
    03-27-2014
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Macro to Auto Add Sheet Name to Summary Page In Workbook

    So what I did was I created a separate worksheet called Stock List and changed it in your VBA code so that every time I add a sheet it populates on that sheet instead of the Profit Distribution Summary Sheet and just put in a formula in the Summary page to pick it up!!! Finally we conquered!! Thanks for your help!!!

+ 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. New sheet based on template to auto populate column in summary page
    By RichTea88 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-05-2014, 07:52 AM
  2. Multi sheet workbook, with Summary page
    By twix in forum Excel General
    Replies: 5
    Last Post: 01-09-2014, 07:29 PM
  3. [SOLVED] Macro to consolidated all data from different sheets to summary sheet in the same workbook
    By rochakmehta90 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-17-2013, 03:10 AM
  4. Help with macro to auto populate summary sheet Excel 2007
    By acook in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-24-2011, 03:01 PM
  5. Replies: 1
    Last Post: 05-22-2006, 03:35 PM

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