+ Reply to Thread
Results 1 to 2 of 2

Generating an Identification number

Hybrid View

  1. #1
    Registered User
    Join Date
    11-13-2006
    Location
    McMinnville, Oregon
    Posts
    1

    Generating an Identification number

    I want to generate an Identification Number called "NCR ID" that is stored in an excel spreadsheet. From the main workbook there is a worksheet that users fill out, it is a Non-Conformance Material Report. It has in it a cell and a command button. When the command button is clicked I need a macro that will:

    A. Look at the data in another workbook listed in the "A" column as sequential numbers, say 0611001 *YearDayNCMR#"
    B.take the last value from that workbook and increment by one(from 0611001 to 0611002) ,
    C. insert the new incremented number in the main workbook cell (K30),
    D. Save the new incremented number into the reference workbook in the next available cell of column "A" and save the revised reference workbook.

    I have very limited macro skills and, while I have found bits and peices of what I'm looking for, I haven't been able to paste it together and have it work correctly. any help would be greatly appreciated.

    -Aaron
    Last edited by Awheeler; 11-13-2006 at 08:06 PM.

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Aaron

    Try this for startes

    Sub MyMaceo()
    Dim sFileSeq As String
    Dim iRow As Integer
    Dim lCounter As Long

    sFileSeq$ = "c:\temp\Seq.xls"
    Workbooks.Open sFileSeq
    iRow = Cells(Rows.Count, "a").End(xlUp).Row
    lCounter = Cells(iRow, "a").Value + 1
    Cells(iRow + 1, "a") = lCounter
    ActiveWorkbook.Close savechanges:=True
    Range("k30").Value = lCounter
    End Sub

+ 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