+ Reply to Thread
Results 1 to 16 of 16

Invoice Details Not Saving Properly to Invoice Payments sheet

  1. #1
    Banned User!
    Join Date
    08-02-2022
    Location
    US
    MS-Off Ver
    365
    Posts
    188

    Invoice Details Not Saving Properly to Invoice Payments sheet

    Hello,

    On the Invoice Template sheet there is a shape "Save" to save some invoice details to the Invoice Payments sheet by a macro "SaveAsPDF".

    The details sometimes are proper but not always. If I create a new invoice with shape "New" on the Invoice Template and fill in the detail Date, Customer ID, some descriptions and quantities then try to save the invoice it sometimes does weird stuff on the Invoice Payments sheet.

    I temporarily disable the part of code that saves the invoice as a PDF file in the onedrive so the code can run for anyone.

    Please try to create a few new invoices and see what happens showing it doesn't always fill in the proper details in the Invoice Payments sheet.

    Thank you very much for your help

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,199

    Re: Invoice Details Not Saving Properly to Invoice Payments sheet

    does weird stuff
    such as ????

    And I note you can SAVE the same invoice more than once!
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  3. #3
    Banned User!
    Join Date
    08-02-2022
    Location
    US
    MS-Off Ver
    365
    Posts
    188

    Re: Invoice Details Not Saving Properly to Invoice Payments sheet

    What is happening is sometimes the row of info that is pasted in the table in the Invoice Payments sheet is not correct in the table columns.

    The last row shows how it is wrong.

    I tried adjusted the code for the offsets but not sure how to fix.

    The idea is to paste the Invoice No., Customer (last name), Invoice Date, Invoice Amount, and Hyperlink to the PDF file in the next row of the table on the Invoice Payments sheet.

    TO get around saving it more than once a formula pops up on the Invoice Template sheet notifying the invoice was saved.

  4. #4
    Banned User!
    Join Date
    08-02-2022
    Location
    US
    MS-Off Ver
    365
    Posts
    188

    Re: Invoice Details Not Saving Properly to Invoice Payments sheet

    Perhaps new code to copy and paste to next row in table?

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,434

    Re: Invoice Details Not Saving Properly to Invoice Payments sheet

    You need to ensure that the cells/ranges are properly/fully qualified.

    For example:

    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  6. #6
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: Invoice Details Not Saving Properly to Invoice Payments sheet

    does it work any better if you disable all the sheet protection - it does for me - is it interfering somewhere
    Torachan,

    Mission statement; Promote the use of Tables, Outlaw the use of 'merged cells' and 'RowSource'.

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,434

    Re: Invoice Details Not Saving Properly to Invoice Payments sheet

    TO get around saving it more than once a formula pops up on the Invoice Template sheet notifying the invoice was saved.
    It does not stop it though.

  8. #8
    Banned User!
    Join Date
    08-02-2022
    Location
    US
    MS-Off Ver
    365
    Posts
    188

    Re: Invoice Details Not Saving Properly to Invoice Payments sheet

    Thank you for your help guys. I applied the individual sheets involved for the code to run unprotect and protect at certain places in the code and it seems to work just fine.

    Please Login or Register  to view this content.

  9. #9
    Banned User!
    Join Date
    08-02-2022
    Location
    US
    MS-Off Ver
    365
    Posts
    188

    Re: Invoice Details Not Saving Properly to Invoice Payments sheet

    When selecting the sheets to protect it seems to slow down the run of the code. Is there a way to edit the protection of the individual sheets so they are not being selected?



    Please Login or Register  to view this content.
    Last edited by 75Rupert; 08-07-2022 at 05:41 AM.

  10. #10
    Banned User!
    Join Date
    08-02-2022
    Location
    US
    MS-Off Ver
    365
    Posts
    188

    Re: Invoice Details Not Saving Properly to Invoice Payments sheet

    Torachan referring to #6 yes the protection is what is interfering with the saving of the invoice. I need to have the protection so the sheets don't get messed up accidentally.

    The #8 post shows the code that seems to work but slowly because it is selecting the individual sheets to activate and protect during the code run.

    Is there a way to protect the 2 sheets (Invoice Template and Invoice Payments) at the end of the code run but not have them temporarily pop up and slow down the code run?

    I am aware when the PDF file is being generated there is a delay but it would be better if the running of the code is faster.

    Thank you

  11. #11
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,434

    Re: Invoice Details Not Saving Properly to Invoice Payments sheet

    Use this:
    Please Login or Register  to view this content.
    Instead of this:
    Please Login or Register  to view this content.
    You should avoid the use of Select. It is unnecessary. You can operate on pretty much anything without selecting it.

    Also avoid ActiveSheet. Be specific about what sheet you want to refer to; it prevents any confusion regarding which sheet is actually active as opposed to which sheet you THINK is active.

  12. #12
    Banned User!
    Join Date
    08-02-2022
    Location
    US
    MS-Off Ver
    365
    Posts
    188

    Re: Invoice Details Not Saving Properly to Invoice Payments sheet

    Much better thanks TMS it does run faster.

    I made the adjustments in the code.

    Are there any other improvements to the code that you can recommend?

    Please Login or Register  to view this content.

  13. #13
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,434

    Re: Invoice Details Not Saving Properly to Invoice Payments sheet

    I think the StartNewInvoice should have the same adjustments as SaveAsPDF. That is, the qualified cell references.

  14. #14
    Banned User!
    Join Date
    08-02-2022
    Location
    US
    MS-Off Ver
    365
    Posts
    188

    Re: Invoice Details Not Saving Properly to Invoice Payments sheet

    Thanks TMS I added those but when running the code there are other sheets that still partially popup during the code run.

    Maybe this is unavoidable not sure.

  15. #15
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: Invoice Details Not Saving Properly to Invoice Payments sheet

    @75Rupert, probably not the advice you would want to hear, however I would advise a fresh approach to what you are trying to achieve.
    What you are creating is a combination of graphics interface, pseudo database coupled to a dynamic spreadsheet - (aka 'nightmare').
    With the sheets containing a multitude of formula; every entry causes every formula to recalculate, as your app expands it will become steadily slower.
    Everyone has differing approaches, but if I wanted to be sure that my app would still work in a year or two with thousands of rows of data, I would be inclined to remove all formula from the sheets and use code to update only the elements that are data entered, to this end I would use bespoke UserForms and use the sheets as pure data storage, devoid of any formula, data validation or conditional formatting.

  16. #16
    Banned User!
    Join Date
    08-02-2022
    Location
    US
    MS-Off Ver
    365
    Posts
    188

    Re: Invoice Details Not Saving Properly to Invoice Payments sheet

    Torachan,

    I understand what you are saying as more data is entered the formulas will slow down the workbook.

    This will be a huge undertaking but I am willing to put forth the effort.

    But I am not sure where to start.

    Any advice would be greatly appreciated.

+ 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. Payment time between invoice and payments
    By NLidddell in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-10-2021, 06:34 AM
  2. Replies: 10
    Last Post: 02-20-2019, 11:34 AM
  3. [SOLVED] Sum invoice payments without duplicates
    By kgkgkg9009 in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 09-17-2016, 07:46 AM
  4. Replies: 1
    Last Post: 06-12-2014, 10:58 AM
  5. Saving Invoice where next time I open file the Invoice Number increases by 1
    By domgee in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-22-2013, 03:03 PM
  6. Invoice and Its Saving File - Invoice draft
    By kuzna26 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-13-2013, 12:13 AM
  7. Replies: 4
    Last Post: 11-04-2012, 12:43 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