+ Reply to Thread
Results 1 to 5 of 5

Correcting macro consecutive numbering

  1. #1
    Forum Contributor
    Join Date
    05-16-2012
    Location
    Latina, ITALY
    MS-Off Ver
    Excel 2010--2016
    Posts
    947

    Correcting macro consecutive numbering

    Good evening
    I need help to change the macro provided below.
    Every month I run this macro and update me H4-H7 automatically about 200 files I open down.
    The amendment, if possible, in cell H4 find this last invoice number "Unw2016 / 06526" I wish with each open file increases I numbering automatically then becomes "Unw2016 / 06527" other files "Unw2016 / 06528" other files "Unw2016 / 06529 ".... to all open files.
    Thanks so much
    Please Login or Register  to view this content.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Correcting macro consecutive numbering

    If you're saying that every time you open another file - presumably with a macro which you don't show, you wish to increment the number then you need to create a Variable and use it to increment the invoice number every time you open another file. Normally I'd suggest a Public VBA Variable but since you will want to keeo incrementing the number in succeeding months then I suggest you hold then variable in a named cell called say "InvoiceNo"

    Put the value 6526 in the named cell. Then in the macro that opens the file add

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Then in your macro1 use

    Please Login or Register  to view this content.
    Note you don't need all the .Select stuff in your macro. Just use the same sytax for H5:H7 as the above. And rather than hard code stuff like "10/05/2016") in the macro, create a variable in the workbook somewhere and use that so that you don't need tio edit the macro every month.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Contributor
    Join Date
    05-16-2012
    Location
    Latina, ITALY
    MS-Off Ver
    Excel 2010--2016
    Posts
    947

    Re: Correcting macro consecutive numbering

    thank you Richard for your kindness
    I understand what you say but do not know how to apply it.
    I am attaching the file with the macro.
    when I open the file I open all the other 200 and I varies on all the H4-H7 cells
    but the cell H4 would like with the numbers to each file, and so I was all the same number.
    Attached Files Attached Files

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Correcting macro consecutive numbering

    I'm confused by your mention of opening 200 files.

    Do you mean that you want every file you open to have its H4 invoice number incremented automatically at the time you open the file?

    If that's the case then use the Workbook Open event macro in each of the 200 files. i.e.

    Please Login or Register  to view this content.
    Alternatively, if you want to avoid having to add the macro to all 200 workbooks then you could create a Module level Procedure with the same code in your Personal Workbook, and then run that procedure when you've opened a file.

  5. #5
    Forum Contributor
    Join Date
    05-16-2012
    Location
    Latina, ITALY
    MS-Off Ver
    Excel 2010--2016
    Posts
    947

    Re: Correcting macro consecutive numbering

    the files are all open with everyone in H4 brings an old invoice number.
    With the macro is automatically added to all files in the H4 first valid number of the month .. 06526.
    I would like that the first file open ports 06526 on the second file ..06527 the third ..06528 files etc ...
    if possible

+ 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. consecutive numbering system
    By Lizzietish11 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-14-2013, 03:50 PM
  2. [SOLVED] consecutive numbering from one workbook to another
    By cprpacific in forum Excel General
    Replies: 2
    Last Post: 03-15-2013, 01:58 PM
  3. Excel 2007 : Consecutive numbering
    By Keith24249 in forum Excel General
    Replies: 4
    Last Post: 06-08-2011, 03:03 PM
  4. Numbering non-consecutive rows
    By Trishay321 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-08-2011, 01:27 PM
  5. Automatic Consecutive numbering?
    By missytordrup in forum Excel - New Users/Basics
    Replies: 6
    Last Post: 11-18-2008, 04:28 PM
  6. [SOLVED] Consecutive numbering
    By Lella in forum Excel General
    Replies: 11
    Last Post: 05-12-2006, 03:45 PM
  7. [SOLVED] consecutive numbering
    By joan in forum Excel General
    Replies: 1
    Last Post: 11-16-2005, 02:45 PM
  8. [SOLVED] consecutive numbering
    By [email protected] in forum Excel General
    Replies: 1
    Last Post: 10-10-2005, 05:05 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