+ Reply to Thread
Results 1 to 8 of 8

Auto-incrementing item reference number over multiple sheets

  1. #1
    Registered User
    Join Date
    06-06-2011
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2007
    Posts
    11

    Auto-incrementing item reference number over multiple sheets

    Hello All,

    I have a set of sheets where I put in various types of call centre data - one line item per call. The sheet where this line is entered depends on the type of call.

    I would like to have a unique number assigned to the line item when that line is filled (regardless of the sheet on which I happen to be). I think that the easiest thing would be to have a sheet containing the base number from which that unique item number is calculated. For example, I begin answering a call. I enter the date on the next empty line in the sheet according to the call type. Tabbing over to the next cell (column C) will pull the reference number from the base number sheet and put it in the first cell of the line I'm entering. The base number is incremented and overwritten on the base number sheet. I continue to fill in the line. For the next call, I may go to the next empty line on that sheet or it may be another sheet. However, entering a date in column B would still cause the reference number to be automatically entered into that line's column A with the number on the reference number sheet to be auto-incremented.

    So, if anyone understands what I'm trying to say, how could I go about doing this?

    Cheers,
    Notwen

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

    Re: Auto-incrementing item reference number over multiple sheets

    Do you have some sample data that you can upload?
    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]

  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: Auto-incrementing item reference number over multiple sheets

    Here's an example of one way to do it with no VBA. The CodeSheet has a named range cell on it named NextNum, that cell is watching column B on the other sheets and finding the max current number then adding one to display. Then that named cell is used in Data Validation on the other sheets so any cell you click in and use the drop down will display the "NextNum". If you use the drop down in one cell, in the next cell it will offer a new number.
    Attached Files Attached Files
    _________________
    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!)

  4. #4
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Auto-incrementing item reference number over multiple sheets

    My effort...

    Please Login or Register  to view this content.
    In the example the code at the moment goes on each sheet's code page that it is to run on but if it was to run on every sheet other than the control one it could be set up as workbook level event.

    Dom
    Attached Files Attached Files
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  5. #5
    Registered User
    Join Date
    06-06-2011
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Auto-incrementing item reference number over multiple sheets

    Thanks to all for their input so far.

    Thank you Domski. Your code works well but you're at a level beyond my humble abilities. I can create the worksheet and workbook level coding but it's the functions you are using that baffle me at the moment. I also need to be able to pad the number and put a prefix on it.

    Maybe I can make things simpler.

    How about I use a reference number on a per sheet basis? I've attached a simple spreadsheet. When I enter the date on the next empty line, the reference number is auto-generated using the base number (upper right, in yellow). As with Domski's code, there should be no user intervention wrt that ref number. That base number is auto-incremented once used.

    Simpler?

    Thanks,
    notwen
    Attached Files Attached Files

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

    Re: Auto-incrementing item reference number over multiple sheets

    Open the VBEditor and remove the code from the individual Sheet modules, if there is any.

    Now open the ThisWorkbook module and put this global macro in...

    Please Login or Register  to view this content.

    This macro will work automatically on every sheet if there is a NUMERIC value in cell E1 of that sheet... a code will be entered anytime you enter a value in column B.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    06-06-2011
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2007
    Posts
    11

    [SOLVED] Re: Auto-incrementing item reference number over multiple sheets

    Nice. Thanks, JB, for burning the midnight oil for me.

    Many thanks to all!

    Cheers,
    notwen

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

    Re: Auto-incrementing item reference number over multiple sheets

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

+ 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