+ Reply to Thread
Results 1 to 10 of 10

Invoice Template and Database System

  1. #1
    Registered User
    Join Date
    01-20-2012
    Location
    HK
    MS-Off Ver
    Excel 2010
    Posts
    14

    Invoice Template and Database System

    Hey,

    I am looking to create a system where by.

    The workbook will act as a template for invoice creation and also a database for all created invoices.

    It will have a 'save' button. Upon pressing the button, the information filled out on the invoice form, such as Customer Name, Date, Order Value etc. are moved into a database in a separate sheet in the same workbook, and also a save prompt comes up, allowing the user to save the invoice they created. Once the invoice file is closed, the template clears itself for the next entry, but the information in the database remains.

    I have attached the sample system. invoice system.xls

    When the button is pushed, I would like a 'save as' dialog to pop up, so that the person can save the invoice they created, but not the 'invoice database', also at the same time, the information in the cells marked red get pushed to the database in the second sheet. Then, the next time someone opens the file, the first sheet should be blank and ready to enter a new invoice.


    Does anyone know how to go about this?

    Thanks for your help folks at excelforum

  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: Invoice Template and Database System

    Basic techniques you can use to build your own macro:

    1) Spot the next empty row in the database, then place values in that row

    Please Login or Register  to view this content.
    2) Copy the active sheet to a new workbook:
    Please Login or Register  to view this content.
    3) Save an Activeworkbook - Google up and use the GetSaveAsFilename method to save the active workbook

    4) Clear values in a cell:
    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 04-13-2012 at 07:11 AM.
    _________________
    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 JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Invoice Template and Database System

    duplicate, sorry.

  4. #4
    Forum Contributor PingPing's Avatar
    Join Date
    02-19-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    158

    Re: Invoice Template and Database System

    Put the below code in the Code Module of the Invoice worksheet and assign the Button1_Click macro to your button.
    Please Login or Register  to view this content.

  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: Invoice Template and Database System

    @PingPing - be careful using the xlCellTypeLastCell method to determine the last used row on a sheet. It will "usually" work, but Excel lies about that answer to that sometimes, and you'll find inexplicable gaps in the data recorded. Not a huge problem, more of an irritant, which is why I don't apply that method.

  6. #6
    Forum Contributor PingPing's Avatar
    Join Date
    02-19-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    158

    Re: Invoice Template and Database System

    Thanks for the tip.

  7. #7
    Registered User
    Join Date
    01-20-2012
    Location
    HK
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Invoice Template and Database System

    Quote Originally Posted by PingPing View Post
    Put the below code in the Code Module of the Invoice worksheet and assign the Button1_Click macro to your button.
    Please Login or Register  to view this content.
    Thanks for your reply,

    I tried to use it and it indeed does move the information into the database tab.

    However, it does not clear the information from the original cells with the information in them, i need the original file to be cleared for the next person to input the next invoice. I intend to use this file as a template and a database so that my employees can use it to create invoices and I can use it to track invoices created.
    Last edited by ROSH22; 04-15-2012 at 11:24 PM.

  8. #8
    Forum Contributor PingPing's Avatar
    Join Date
    02-19-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    158

    Re: Invoice Template and Database System

    Quote Originally Posted by ROSH22 View Post
    it does not clear the information from the original cells with the information in them, i need the original file to be cleared for the next person to input the next invoice.
    That's trivial. Insert the following line at the end of the previous code:
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    11-23-2012
    Location
    Nova Scotia
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Invoice Template and Database System

    Hi
    I'm wondering if anyone would be able to help me. I started a new job and am trying to set up the invoicing in the same way, the only difference is I would love if the invoice number would auto populate with the next invoice number.
    I tried adapting this code to my invoice but I am brand new at this and trying to learn as I go. At this point I'm basically stabbing in the dark and I'm starting to get really frustrated.
    If anyone could help my I would be so grateful.
    I attached a blank invoice.
    Attached Files Attached Files

  10. #10
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Invoice Template and Database System

    kmp0511,

    Unfortunately you need to post your question in a new thread, it's against the forum rules to post a question in the thread of another user. If you create your own thread, any advice will be tailored to your situation so you should include a description of what you've done and are trying to do. Also, if you feel that this thread is particularly relevant to what you are trying to do, you can surely include a link to it in your new thread.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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