+ Reply to Thread
Results 1 to 7 of 7

Running Save /Update Clears Formula In B5 of Invoice Template

  1. #1
    Forum Contributor
    Join Date
    02-26-2023
    Location
    Lousianna
    MS-Off Ver
    Microsoft 365
    Posts
    932

    Running Save /Update Clears Formula In B5 of Invoice Template

    Hi,

    I have a formula in cell B5 of the Invoice Template sheet for the Maximum Invoice Number from the Invoice List sheet. This is intended so the next new invoice will be that number + 1.

    When running the code by clicking the shape 'Save / Update Invoice' it removes the formula and the next new number is not the highest invoice + 1. In the examples listed it should be Invoice 1018.

    Can someone please help?

    Thank you
    Attached Files Attached Files

  2. #2
    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,463

    Re: Running Save /Update Clears Formula In B5 of Invoice Template

    Guessing the problem is because of these lines:

    Please Login or Register  to view this content.
    Here you are setting the value of cell B5 to the value of the variable invno plus one. Hence you over-write the formula in B5 with a fixed value.
    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


  3. #3
    Forum Contributor
    Join Date
    02-26-2023
    Location
    Lousianna
    MS-Off Ver
    Microsoft 365
    Posts
    932

    Re: Running Save /Update Clears Formula In B5 of Invoice Template

    Yes that does seem like where the issue is. How can the new invoice be the next higher number?

    Can this be done so that cell B5 does not get over written?

  4. #4
    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,463

    Re: Running Save /Update Clears Formula In B5 of Invoice Template

    Well, the formula in cell B5 returns the maximum invoice used according to the Invoice List. So, logically, it can't be both the maximum invoice number used AND the next invoice number to be used.

    Seems like you need to have two cells if you want to display and/or use two different numbers.

  5. #5
    Forum Contributor
    Join Date
    02-26-2023
    Location
    Lousianna
    MS-Off Ver
    Microsoft 365
    Posts
    932

    Re: Running Save /Update Clears Formula In B5 of Invoice Template

    Ultimately I would like the new invoice to be the next higher invoice number. Perhaps I am going about this wrong.

    In the code what determines the new invoice number?

  6. #6
    Forum Contributor
    Join Date
    02-26-2023
    Location
    Lousianna
    MS-Off Ver
    Microsoft 365
    Posts
    932

    Re: Running Save /Update Clears Formula In B5 of Invoice Template

    I found a way to do it. Maybe it is not proper but seems to work.


    cell B4 I have the formula: =MAX(Invoice_ID)
    cell B5 gets the next new number when running the code.

    Please Login or Register  to view this content.

  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,463

    Re: Running Save /Update Clears Formula In B5 of Invoice Template

    You're welcome. Thanks for the rep.


    Always best if you can work it out for yourself. Then you have a better understanding of what's going on.

+ 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. [SOLVED] Save as xlsx from xlsm code update in the same folder as the template
    By PaulM100 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-13-2018, 05:09 AM
  2. [SOLVED] Invoice template total column formula
    By Lilgnomey in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-28-2014, 08:39 AM
  3. [SOLVED] Save invoice to folder by month and then save file by date and invoice
    By Val777 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-03-2013, 02:57 AM
  4. Running invoice no. in Template used by multiple users
    By impresxy in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 04-10-2013, 04:50 AM
  5. Re-running macro clears row 1 - why?
    By SDBoca in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-14-2011, 02:58 PM
  6. save from template to worksheet without update commands
    By Office User in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-14-2005, 03:06 AM
  7. [SOLVED] How do I change the invoice number assigned in Invoice template...
    By akress in forum Excel General
    Replies: 1
    Last Post: 02-28-2005, 03:06 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