+ Reply to Thread
Results 1 to 10 of 10

Macro to Generate new Quote TaB

  1. #1
    Forum Contributor
    Join Date
    02-09-2004
    Location
    Cardiff - Wales - UK
    MS-Off Ver
    2013
    Posts
    475

    Macro to Generate new Quote TaB

    Hi,

    What I require is the macro code to achieve the following:-

    Cells A2, B2 and C2 will be completed manually, however, when a new quotation is required the user must enter a new Control Reference Number in cell E2 and then press the Generate button.

    Once pressed the Macro behind the button will generate the following :-

    (a) Quote number underneath the last one in column 'A'

    (b) Change Ref underneath the last one in column 'B' (this was the ref number input above in E2)

    (c) today’s date underneath the last one in column 'C'

    (d) a blank Quote Tab i.e. labelled the next number in the sequence i.e. Quote 2, Quote 3 etc which should be created copying the Template Tab

    N.B. the total number of Quotes in any one work book should be a maximum of 30 so some form of checking would be required.


    Please see attached spread sheet as an example


    Many thanks in advance for any assistance

    Excel version 2003


    Regards


    Rob
    Attached Files Attached Files
    Last edited by robertguy; 03-23-2009 at 01:57 PM. Reason: To Mark Resolved
    Rob

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to Generate new Quote TaB

    This is the code I added into that Command Button:
    Please Login or Register  to view this content.
    It will provide an error if you click it without entering a value first.
    Last edited by JBeaucaire; 03-22-2009 at 03:20 AM. Reason: Removed book, use one further down.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Macro to Generate new Quote TaB

    Try this:
    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Contributor
    Join Date
    02-09-2004
    Location
    Cardiff - Wales - UK
    MS-Off Ver
    2013
    Posts
    475

    Question Re: Macro to Generate new Quote TaB

    JBeaucaire & Shg

    Many thanks for your prompt replies they both work a treat, BUT….

    Is it possible to limit the number new quote tabs to 30


    Many thanks


    Rob

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to Generate new Quote TaB

    Here's the updated code, forgot to make it copy the template sheet. It also limits the workbook to 32 sheets, 30 Quotes plus your control sheet and template.
    Please Login or Register  to view this content.
    If you max the sheet you will receive an error prompt.
    If you fail to enter a Control Code, you will receive an error prompt.
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    02-09-2004
    Location
    Cardiff - Wales - UK
    MS-Off Ver
    2013
    Posts
    475

    Question Minor Refinement Required

    JBeaucaire

    Many thanks for the amendment it is very much appreciated, however, when I hide the ‘Template’ tab for cosmetic purposes any new ‘Quote’ tabs generated are also hidden.

    Is there a way to hide the ‘Template’ tab and show all the ‘newly created Quote’ tabs when you press the Generate button ?


    Additionally, sometimes when I delete any of the ‘Quote’ tabs generated and then generate a new sheet via the Generate button the newly formed Tab are named ‘Template 01, ‘Template 02’ etc. Is there a way to tweak the code so all Tabs generated will only be named ‘Quote xx’ as originally intended.

    Any further assistance would be greatly appreciated


    Regards


    Rob

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to Generate new Quote TaB

    Add this line of code at the bottom of the macro:
    Please Login or Register  to view this content.
    I can't duplicate your second problem.

    Would you like to clean up the input process? We could eliminate cell E2 and just put the prompt for the control reference # into the macro itself? Just an idea.

  8. #8
    Forum Contributor
    Join Date
    02-09-2004
    Location
    Cardiff - Wales - UK
    MS-Off Ver
    2013
    Posts
    475

    Question Eliminate cell E2

    JBeaucaire

    Many thanks for the additional code it is very much appreciated.

    As regards to cleaning up the process to eliminate cell E2 and just put the prompt for the control reference # into the macro itself that would be really good.

    Is there anyway the prompt box could have two buttons i.e. ‘OK’ and ‘Cancel’ .

    Any further assistance would be greatly appreciated.

    Regards


    Rob

  9. #9
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to Generate new Quote TaB

    Use this instead:
    Please Login or Register  to view this content.
    If that takes care of your need, be sure to EDIT your original post (Go Advanced) and mark the PREFIX box [SOLVED]

  10. #10
    Forum Contributor
    Join Date
    02-09-2004
    Location
    Cardiff - Wales - UK
    MS-Off Ver
    2013
    Posts
    475

    Smile Re: Macro to Generate new Quote TaB

    JBeaucaire

    many thanks for all your advice it is very much appreciated and works better than I expected

    Best Regards


    Rob

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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