+ Reply to Thread
Results 1 to 12 of 12

Consecutive numbering

  1. #1
    Lella
    Guest

    Consecutive numbering

    I've designed a Job sheet for work where all the information of certain jobs
    are saved. I need to be able to open the template and have the consecutive
    number of the sheet change. i.e. If my first job sheet is labeled as Job #
    929 the next time I open the template I need it to read # 930. I'm completely
    confused.

  2. #2
    Dave O
    Guest

    Re: Consecutive numbering

    This type of thing can be done- the problem is arranging it to work
    only once. If you open the template and the job number advances by one
    and then you save the template, if we're not careful the next time you
    open the file it will advance by one again, and create a lot of
    confusion. So in order to create a bulletproof solution, can you
    please describe how you will be using these files? For instance: you
    have a Job sheet master template; you'll open it, use it, apply job
    information, save it under a different file name, refer to it
    periodically, etc.


  3. #3
    Lella
    Guest

    Re: Consecutive numbering



    "Dave O" wrote:

    > This type of thing can be done- the problem is arranging it to work
    > only once. If you open the template and the job number advances by one
    > and then you save the template, if we're not careful the next time you
    > open the file it will advance by one again, and create a lot of
    > confusion. So in order to create a bulletproof solution, can you
    > please describe how you will be using these files? For instance: you
    > have a Job sheet master template; you'll open it, use it, apply job
    > information, save it under a different file name, refer to it
    > periodically, etc.
    >
    > That's exactly right. I'll be saving it under the actual job number and email that sheet to specified depts where it will be opened and changes may be made and saved again. The next time I open the original template it will be for a different job. I hope this clarifies it a bit.


  4. #4
    Lella
    Guest

    Re: Consecutive numbering



    "Dave O" wrote:

    > This type of thing can be done- the problem is arranging it to work
    > only once. If you open the template and the job number advances by one
    > and then you save the template, if we're not careful the next time you
    > open the file it will advance by one again, and create a lot of
    > confusion. So in order to create a bulletproof solution, can you
    > please describe how you will be using these files? For instance: you
    > have a Job sheet master template; you'll open it, use it, apply job
    > information, save it under a different file name, refer to it
    > periodically, etc.
    >
    >


  5. #5
    Dave O
    Guest

    Re: Consecutive numbering

    I've figured out some code to make this work- but I need to know: is
    there a cell in your Job sheet that is *** ALWAYS *** blank in the
    template and that is *** ALWAYS *** completed when you apply job data
    to a job? The date? The client name? Anything like that will do.


  6. #6
    Dave O
    Guest

    Re: Consecutive numbering

    Forgot to mention: I need the tab name and cell address, too.


  7. #7
    Lella
    Guest

    Re: Consecutive numbering



    "Dave O" wrote:

    > I've figured out some code to make this work- but I need to know: is
    > there a cell in your Job sheet that is *** ALWAYS *** blank in the
    > template and that is *** ALWAYS *** completed when you apply job data
    > to a job? The date? The client name? Anything like that will do.
    >
    > Yes. The sheet just has basic headings ie Job #, Date, Show name etc. that are completed every time I fill it out.


  8. #8
    Lella
    Guest

    Re: Consecutive numbering



    "Dave O" wrote:

    > Forgot to mention: I need the tab name and cell address, too.
    >
    > I don't know if this is what you're referring to but I-3 is where the Job number would be. Is that right?


  9. #9
    Dave O
    Guest

    Re: Consecutive numbering

    Not quite- but we'll get there. Here's what I need you to do, starting
    with step 0 because I forgot to make this step 1:
    0. Create a backup copy of your template, so you can recover data in
    case of a catastrophe.

    1. Open the template and create a named range called JobNumber (spelled
    just like that) by clicking on the menu *Insert *Name *Define. In the
    top box type JobNumber and in the bottom box type =930 (or whatever
    your current job number is). Click OK.

    2. In cell I3, the job number cell, enter the formula =JobNumber and
    the current job number will appear.

    3. With the template showing on screen, press ALT-F11 to display the
    Visual Basic editor. There is a project pane on the left side of the
    window; in that pane your template's file name is displayed in bold
    font. Below that is an icon for This Workbook. Right-click This
    Workbook and select View Code. Copy and paste this code into the pane
    on the right:

    Private Sub Workbook_Open()
    If Range("sheet1!c3").Value = "" Then Names("JobNumber").Value =
    Evaluate(Names("JobNumber").Value) + 1
    End Sub

    4. Notice this part of the code: Range("sheet1!c3")
    Change the sheet1 to match the tab name of your sprdsht, and change c3
    to the client name's cell or another cell that is blank in the template
    but that will be filled in for a job.

    5. Note the job number displayed in I3, save the file, close it, open
    it again, and you should see the job number has incremented by one.

    6. Fill in a dummy name or whatever in the cell you indicated in step
    4, save the file as though it was an actual job, and reopen. You
    should see the job number has NOT incremented by one.

    Let me know how it goes!


  10. #10
    Dave O
    Guest

    Re: Consecutive numbering

    Note: the newsgroup may have word-wrapped this on your screen:
    If Range("sheet1!c3").Value = "" Then Names("JobNumber").Value =
    Evaluate(Names("JobNumber").Value) + 1

    Make sure this is all on one line in the Visual Basic editor.


  11. #11
    Lella
    Guest

    Re: Consecutive numbering



    "Dave O" wrote:

    > Note: the newsgroup may have word-wrapped this on your screen:
    > If Range("sheet1!c3").Value = "" Then Names("JobNumber").Value =
    > Evaluate(Names("JobNumber").Value) + 1
    >
    > Make sure this is all on one line in the Visual Basic editor.
    >
    > IT WORKED! IT WORKED! Thank you so much. You've lifted a great burden off my shoulders.


  12. #12
    Dave O
    Guest

    Re: Consecutive numbering

    Wow, first time out? Cool! Have a great weekend.


+ 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