Userform Unique reference number question

  • Hi,


    I current use the below piece of code to generate a sequential reference number on a userform.


    Code
    1. With ReferenceNumber
    2. .Value = Cells(1, 1) & Format(Cells(Rows.Count, 1).End(xlUp).Row, "000")
    3. .Enabled = False
    4. End With


    This works fine but what im trying to do is not have it done by counting the row as I already have some reference numbers in there.


    The sheet that it transfers to starts at row 3 but the count starts on "002".


    Is it possible to have it count directly on from the last reference without it being linked to the row its on?


    Thanks in advance.

  • Re: Userform Unique reference number question


    Hi GhostMonkey72,


    Try:

    Code
    1. With ReferenceNumber
    2. .Value = Cells(1, 1).Value & Format(Val(Replace(Cells(Rows.Count, 1).End(xlUp).Value, Cells(1, 1).Value, "")) + 1, "000")
    3. .Enabled = False
    4. End With

    [COLOR="Purple"]Regards,[/COLOR]
    [COLOR="Purple"]Batman.[/COLOR]