+ Reply to Thread
Results 1 to 4 of 4

insert row and increment alphanumeric unique ID

  1. #1
    Registered User
    Join Date
    06-03-2013
    Location
    brussels
    MS-Off Ver
    Excel 2007
    Posts
    94

    insert row and increment alphanumeric unique ID

    Can someone help out please building a macro enabling:

    in column A3 I have a unique ID "RISK_001"

    The macro should insert a row and populate next entry (A4) with id "RISK_002"

  2. #2
    Registered User
    Join Date
    06-03-2013
    Location
    brussels
    MS-Off Ver
    Excel 2007
    Posts
    94

    Re: insert row and increment alphanumeric unique ID

    I have made a first almost successfull attempt , howver the counting always starts at 002 and not 001.

    Sub Add_record()

    Dim lr As Long
    Dim c As String

    Application.ScreenUpdating = False

    With Sheets("risks")
    lr = .Cells(Rows.Count, "A").End(xlUp).Row
    c = "Risk_" & Format(lr, "000")
    .Cells(lr + 1, 1) = c
    End With

    Application.ScreenUpdating = True

    End Sub

  3. #3
    Registered User
    Join Date
    11-01-2012
    Location
    Cairo, Egypt
    MS-Off Ver
    MS Office 2013
    Posts
    76

    Re: insert row and increment alphanumeric unique ID

    Subtract 1 from lr
    Please Login or Register  to view this content.

  4. #4
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: insert row and increment alphanumeric unique ID

    @rickmeister:
    Please put your code between code tags, highlight the code and then click the "#" button.

    Please Login or Register  to view this content.
    1. I care dog
    2. I am a loop maniac
    3. Forum rules link : Click here
    3.33. Don't forget to mark the thread as solved, this is important

+ 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. Replies: 6
    Last Post: 11-30-2016, 02:38 AM
  2. [SOLVED] Can't increment Alphanumeric string by one
    By Ochimus in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-07-2016, 12:08 AM
  3. [SOLVED] 5-digit Random Unique Alphanumeric Code
    By mcodden in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-15-2015, 02:39 PM
  4. [SOLVED] Alphanumeric Increment based on previous row value
    By JusticeEmpire in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-06-2015, 01:14 PM
  5. Replies: 2
    Last Post: 11-06-2014, 05:07 PM
  6. Increment Alphanumeric Value of a Cell on each print job
    By rudygortiz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-12-2014, 03:55 PM
  7. Replicate and increment alphanumeric keywords?
    By toolsavvy in forum Excel General
    Replies: 7
    Last Post: 12-16-2007, 03:02 AM

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